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-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-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 01:36:51 +00:00
|
|
|
plugins.smartfile.fs.remove(paths.nginxConfigBase);
|
|
|
|
plugins.smartfile.fs.ensureDir(paths.nginxConfigBase);
|
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-06 01:14:44 +00:00
|
|
|
};
|
|
|
|
;
|
|
|
|
return NginxConfig;
|
|
|
|
}());
|
|
|
|
exports.NginxConfig = NginxConfig;
|
|
|
|
;
|
2016-07-08 01:36:51 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5jbGFzc2VzLm5naW54Y29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRuZ2lueC5jbGFzc2VzLm5naW54Y29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxzQkFBc0IsQ0FBQyxDQUFBO0FBQ2hELElBQVksS0FBSyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDNUMsSUFBWSxPQUFPLFdBQU0sc0JBQXNCLENBQUMsQ0FBQTtBQUNoRCxJQUFZLFFBQVEsV0FBTSx1QkFDMUIsQ0FBQyxDQURnRDtBQUVqRCxJQUFJLFVBQVUsR0FBaUIsRUFBRSxDQUFDO0FBRWxDO0lBR0k7UUFEQSxlQUFVLEdBQVcsS0FBSyxDQUFDO0lBRzNCLENBQUM7O0lBRUQsc0JBQXNCO0lBQ3RCLDZCQUFPLEdBQVAsVUFBUSxPQUFpQjtJQUV6QixDQUFDO0lBQ0QsK0JBQVMsR0FBVDtRQUNJLE1BQU0sQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDO0lBQ3RCLENBQUM7O0lBQ0QsaUNBQVcsR0FBWCxVQUFZLE9BQWlCO0lBRTdCLENBQUM7SUFFRCw2QkFBNkI7SUFDN0IsNEJBQU0sR0FBTixVQUFPLGVBQ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