-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathsetupCDN.jps
24 lines (24 loc) · 1.15 KB
/
setupCDN.jps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
jpsType: update
id: edgeport-cdn-magento
name: Edgeport CDN configuration for Magento
onInstall:
- script: |
import com.hivext.api.Response;
var cdnAppid = "c05ffa5b45628a2a0c95467ebca8a0b4";
var isCDN = jelastic.dev.apps.GetApp(cdnAppid);
var isCdnInstalled = false, partnerCode = "";
if (isCDN.result == 0 || isCDN.result == Response.PERMISSION_DENIED) {
isCdnInstalled = jelastic.dev.scripting.Eval("appstore", session, "GetApps", {
targetAppid: '${env.appid}',
search: {
appstore: 1,
app_id: "cdn"
}
});
if (isCdnInstalled.result != 0) return isCdnInstalled;
partnerCode = jelastic.dev.scripting.Eval(cdnAppid, session, "cdn.info", {partnerCode:1});
if (partnerCode.result != 0) return partnerCode;
if (isCdnInstalled.response.apps[0].isInstalled)
return jelastic.env.control.ExecCmdById('${env.envName}', session, '${nodes.cp.master.id}', toJSON([{ command:' bash ~/bin/japp.sh edgeportCDN --cdn-url ${env.envName}-'+partnerCode.response.partnerCode+'.cdn.jelastic.net ' }]), true);
}
return { result: 0 }