60 lines
3.9 KiB
JavaScript
60 lines
3.9 KiB
JavaScript
"use strict";
|
|
var plugins = require("./smartnginx.plugins");
|
|
var paths = require("./smartnginx.paths");
|
|
var command = require("./smartnginx.command");
|
|
(function (ZoneTypes) {
|
|
})(exports.ZoneTypes || (exports.ZoneTypes = {}));
|
|
var ZoneTypes = exports.ZoneTypes;
|
|
var allConfigs = [];
|
|
var NginxConfig = (function () {
|
|
function NginxConfig() {
|
|
this.isDeployed = false;
|
|
}
|
|
;
|
|
// interact with Zones
|
|
NginxConfig.prototype.addZone = function (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.remove(paths.nginxZoneBase);
|
|
plugins.smartfile.fs.ensureDir(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();
|
|
}
|
|
if (nginxRestartArg) {
|
|
command.restart(this);
|
|
}
|
|
};
|
|
;
|
|
return NginxConfig;
|
|
}());
|
|
exports.NginxConfig = NginxConfig;
|
|
;
|
|
var NginxZone = (function () {
|
|
function NginxZone(optionsArg) {
|
|
}
|
|
;
|
|
NginxZone.prototype.deploy = function () {
|
|
var filePath = plugins.path.join(paths.nginxZoneBase, this.zoneName + ".conf");
|
|
plugins.smartfile.memory.toFsSync(this.configString, filePath);
|
|
};
|
|
;
|
|
return NginxZone;
|
|
}());
|
|
exports.NginxZone = NginxZone;
|
|
var mynginx = new NginxConfig();
|
|
//# sourceMapp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