-
Notifications
You must be signed in to change notification settings - Fork 6
/
ModuleConfig.cfc
43 lines (37 loc) · 1.26 KB
/
ModuleConfig.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
component {
function configure() {
settings = {
ngrokPath = "#modulePath#/bin/#getNgrokBinaryName()#"
};
interceptors = [
{ class = "#moduleMapping#.interceptors.StopTunnelOnServerStopInterceptor" }
];
}
function onLoad() {
var fs = wirebox.getInstance( "FileSystem" );
if ( fs.isMac() ) {
cfexecute(
name = "chmod",
arguments = "755 #modulePath#/bin/#getNgrokBinaryName()#",
timeout = 1
);
}
}
private string function getNgrokBinaryName() {
var fs = wirebox.getInstance( "FileSystem" );
if ( fs.isWindows() ) {
return "ngrok-windows.exe";
}
if ( fs.isLinux() ) {
return isArm() ? "ngrok-linux-arm" : "ngrok-linux-intel";
}
if ( fs.isMac() ) {
return isArm() ? "ngrok-mac-arm" : "ngrok-mac-intel";
}
throw( "Unsupported platform" );
}
private boolean function isArm() {
var systemSettings = wirebox.getInstance( "SystemSettings" );
return systemSettings.getSystemSetting( 'os.arch', '' ).findNoCase( 'arm' ) || systemSettings.getSystemSetting( 'os.arch', '' ).findNoCase( 'aarch' );
}
}