import * as plugins from "./smartnginx.plugins"; import * as paths from "./smartnginx.paths"; import * as command from "./smartnginx.command"; import * as snippets from "./smartnginx.snippets" 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.nginxConfigBase); plugins.smartfile.fs.ensureDir(paths.nginxConfigBase); for(let config of allConfigs){ config.isDeployed = false; }; this.isDeployed = true; for(let zone of this.zones){ zone.deploy(); }; plugins.smartfile.memory.toFsSync( snippets.getBaseConfigString(), plugins.path.join(paths.nginxConfigBase,"nginx.conf") ); if(nginxRestartArg){ command.restart(this); } }; };