smartnginx/dist/smartnginx.classes.nginxconfig.js

51 lines
3.7 KiB
JavaScript
Raw Normal View History

2016-07-06 01:14:44 +00:00
"use strict";
2016-07-06 04:33:31 +00:00
var plugins = require("./smartnginx.plugins");
var paths = require("./smartnginx.paths");
var command = require("./smartnginx.command");
2016-07-08 01:36:51 +00:00
var snippets = require("./smartnginx.snippets");
2016-07-06 04:33:31 +00:00
var allConfigs = [];
2016-07-06 01:14:44 +00:00
var NginxConfig = (function () {
function NginxConfig() {
2016-07-08 02:24:07 +00:00
this.zones = [];
2016-07-06 04:33:31 +00:00
this.isDeployed = false;
2016-07-06 01:14:44 +00:00
}
;
2016-07-06 01:33:39 +00:00
// interact with Zones
NginxConfig.prototype.addZone = function (zoneArg) {
2016-07-08 02:24:07 +00:00
this.zones.push(zoneArg);
2016-07-06 01:14:44 +00:00
};
2016-07-06 01:33:39 +00:00
NginxConfig.prototype.listZones = function () {
return this.zones;
};
;
NginxConfig.prototype.removeZones = function (zoneArg) {
};
// handle deployment of zones
2016-07-06 04:33:31 +00:00
NginxConfig.prototype.deploy = function (nginxRestartArg) {
if (nginxRestartArg === void 0) { nginxRestartArg = false; }
2016-07-08 02:24:07 +00:00
plugins.smartfile.fs.removeSync(paths.nginxConfigBase);
plugins.smartfile.fs.ensureDirSync(paths.nginxConfigBase);
plugins.smartfile.fs.ensureDirSync(paths.nginxZoneBase);
2016-07-06 04:33:31 +00:00
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();
}
2016-07-08 01:36:51 +00:00
;
plugins.smartfile.memory.toFsSync(snippets.getBaseConfigString(), plugins.path.join(paths.nginxConfigBase, "nginx.conf"));
2016-07-06 04:33:31 +00:00
if (nginxRestartArg) {
command.restart(this);
}
2016-07-08 02:24:07 +00:00
;
2016-07-06 01:14:44 +00:00
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