51 lines
3.7 KiB
JavaScript
51 lines
3.7 KiB
JavaScript
"use strict";
|
|
var plugins = require("./smartnginx.plugins");
|
|
var paths = require("./smartnginx.paths");
|
|
var command = require("./smartnginx.command");
|
|
var snippets = require("./smartnginx.snippets");
|
|
var allConfigs = [];
|
|
var NginxConfig = (function () {
|
|
function NginxConfig() {
|
|
this.zones = [];
|
|
this.isDeployed = false;
|
|
}
|
|
;
|
|
// interact with Zones
|
|
NginxConfig.prototype.addZone = function (zoneArg) {
|
|
this.zones.push(zoneArg);
|
|
};
|
|
NginxConfig.prototype.listZones = function () {
|
|
return this.zones;
|
|
};
|
|
;
|
|
NginxConfig.prototype.removeZones = function (zoneArg) {
|
|
};
|
|
// handle deployment of zones
|
|
NginxConfig.prototype.deploy = function (nginxRestartArg) {
|
|
if (nginxRestartArg === void 0) { nginxRestartArg = false; }
|
|
plugins.smartfile.fs.removeSync(paths.nginxConfigBase);
|
|
plugins.smartfile.fs.ensureDirSync(paths.nginxConfigBase);
|
|
plugins.smartfile.fs.ensureDirSync(paths.nginxZoneBase);
|
|
for (var _i = 0, allConfigs_1 = allConfigs; _i < allConfigs_1.length; _i++) {
|
|
var config = allConfigs_1[_i];
|
|
config.isDeployed = false;
|
|
}
|
|
;
|
|
this.isDeployed = true;
|
|
for (var _a = 0, _b = this.zones; _a < _b.length; _a++) {
|
|
var zone = _b[_a];
|
|
zone.deploy();
|
|
}
|
|
;
|
|
plugins.smartfile.memory.toFsSync(snippets.getBaseConfigString(), plugins.path.join(paths.nginxConfigBase, "nginx.conf"));
|
|
if (nginxRestartArg) {
|
|
command.restart(this);
|
|
}
|
|
;
|
|
};
|
|
;
|
|
return NginxConfig;
|
|
}());
|
|
exports.NginxConfig = NginxConfig;
|
|
;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5jbGFzc2VzLm5naW54Y29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOl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