import * as plugins from "./smartnginx.plugins"; import * as paths from "./smartnginx.paths"; import * as command from "./smartnginx.command"; export enum ZoneTypes { } 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); } }; }; export class NginxZone { zoneName:string; // the zone name e.g. domain name configString:string; // the actual zone config file as string constructor(optionsArg:{ zoneName:string, type:ZoneTypes, destination:string }){ }; deploy(){ let filePath = plugins.path.join(paths.nginxZoneBase,this.zoneName + ".conf"); plugins.smartfile.memory.toFsSync(this.configString,filePath); }; } let mynginx = new NginxConfig();