smartnginx/ts/smartnginx.classes.nginxconfig.ts
2016-07-06 08:30:33 +02:00

42 lines
1003 B
TypeScript

import * as plugins from "./smartnginx.plugins";
import * as paths from "./smartnginx.paths";
import * as command from "./smartnginx.command";
import {NginxZone} from "./smartnginx.classes.nginxzone";
let allConfigs:NginxConfig[] = [];
export class NginxConfig {
zones:NginxZone[];
isDeployed:boolean = false;
constructor(){
};
// interact with Zones
addZone(zoneArg:NginxZone){
}
listZones():NginxZone[] {
return this.zones;
};
removeZones(zoneArg:NginxZone){
}
// handle deployment of zones
deploy(nginxRestartArg:boolean = false){
plugins.smartfile.fs.remove(paths.nginxZoneBase);
plugins.smartfile.fs.ensureDir(paths.nginxZoneBase);
for(let config of allConfigs){
config.isDeployed = false;
};
this.isDeployed = true;
for(let zone of this.zones){
zone.deploy();
}
if(nginxRestartArg){
command.restart(this);
}
};
};