2016-07-06 06:30:33 +00:00
|
|
|
import * as plugins from "./smartnginx.plugins";
|
|
|
|
import * as paths from "./smartnginx.paths";
|
|
|
|
import * as command from "./smartnginx.command";
|
|
|
|
import * as snippets from "./smartnginx.snippets"
|
|
|
|
export enum zoneTypes {
|
|
|
|
reverseProxy,
|
|
|
|
static
|
|
|
|
}
|
|
|
|
|
|
|
|
export class NginxZone {
|
|
|
|
zoneName:string; // the zone name e.g. domain name
|
2016-07-08 02:24:07 +00:00
|
|
|
type:zoneTypes;
|
|
|
|
destination:string;
|
2016-07-06 06:30:33 +00:00
|
|
|
configString:string; // the actual zone config file as string
|
|
|
|
constructor(optionsArg:{
|
|
|
|
zoneName:string,
|
|
|
|
type:zoneTypes,
|
|
|
|
destination:string
|
|
|
|
}){
|
2016-07-08 02:24:07 +00:00
|
|
|
this.zoneName = optionsArg.zoneName;
|
|
|
|
this.type = optionsArg.type;
|
|
|
|
this.destination = optionsArg.destination;
|
2016-07-06 06:30:33 +00:00
|
|
|
this.configString = snippets.getZoneConfigString(optionsArg.zoneName,optionsArg.destination);
|
|
|
|
};
|
|
|
|
deploy(){
|
|
|
|
let filePath = plugins.path.join(paths.nginxZoneBase,this.zoneName + ".conf");
|
|
|
|
plugins.smartfile.memory.toFsSync(this.configString,filePath);
|
|
|
|
};
|
|
|
|
};
|