-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathinstall-ssl.js
80 lines (67 loc) · 2.39 KB
/
install-ssl.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//@url('/${scriptName}')
var action = getParam("action", "install"),
patchVersion = getParam("patchVersion"),
token = getParam("token"),
isTask = getParam("task"),
baseUrl = "${baseUrl}";
function run() {
var SSLManager = use("scripts/ssl-manager.js", {
session : session,
isTask : isTask,
baseUrl : baseUrl,
action : action,
token : "${token}",
email : "${email}",
baseDir : "${baseDir}",
scriptName : "${scriptName}",
envName : "${envName}",
envDomain : "${envDomain}",
appId : "${appId}",
envAppid : "${envAppid}",
nodeId : "${nodeId}",
nodeIp : "${nodeIp}",
nodeGroup : "${nodeGroup}",
customDomains : "${customDomains}",
cronTime : "${cronTime}",
deployHook : "${deployHook}",
deployHookType : "${deployHookType}",
undeployHook : "${undeployHook}",
undeployHookType : "${undeployHookType}",
withExtIp : "${withExtIp}",
withIntSSL : "${withIntSSL}",
webroot : "${webroot}",
webrootPath : "${webrootPath}",
fallbackToX1 : "${fallbackToX1}",
patchVersion : "${patchVersion}",
test : "${test}",
clientVersion : "${clientVersion}"
});
var resp = SSLManager.auth(token);
if (resp.result === 0) {
resp = SSLManager.invoke(action);
}
jelastic.local.ReturnResult(resp);
}
function use(script, config) {
var Transport = com.hivext.api.core.utils.Transport,
body = new Transport().get(baseUrl + "/" + script + "?_r=" + Math.random());
if (!body) {
return {
result : com.hivext.api.Response.ERROR_UNKNOWN,
error: "Error: Unable to get ssl-manager script from GitHub"
}
}
return new (new Function("return " + body)())(config);
}
try {
run();
} catch (ex) {
var resp = {
result : com.hivext.api.Response.ERROR_UNKNOWN,
error: "Error: " + toJSON(ex)
};
if (jelastic.marketplace && jelastic.marketplace.console) {
jelastic.marketplace.console.WriteLog(appid, signature, "ERROR: " + resp);
}
jelastic.local.ReturnResult(resp);
}