2016-07-06 06:30:33 +00:00
|
|
|
"use strict";
|
2016-07-21 00:24:54 +00:00
|
|
|
const plugins = require("./smartnginx.plugins");
|
|
|
|
const paths = require("./smartnginx.paths");
|
|
|
|
const snippets = require("./smartnginx.snippets");
|
2016-07-06 06:30:33 +00:00
|
|
|
(function (zoneTypes) {
|
|
|
|
zoneTypes[zoneTypes["reverseProxy"] = 0] = "reverseProxy";
|
|
|
|
zoneTypes[zoneTypes["static"] = 1] = "static";
|
|
|
|
})(exports.zoneTypes || (exports.zoneTypes = {}));
|
|
|
|
var zoneTypes = exports.zoneTypes;
|
2016-07-21 00:24:54 +00:00
|
|
|
class NginxZone {
|
|
|
|
constructor(optionsArg) {
|
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);
|
|
|
|
}
|
|
|
|
;
|
2016-07-21 00:24:54 +00:00
|
|
|
deploy(certInstanceArg) {
|
|
|
|
let done = plugins.q.defer();
|
|
|
|
let filePath = plugins.path.join(paths.nginxZoneBase, this.zoneName + ".conf");
|
2016-07-12 21:20:08 +00:00
|
|
|
// writeConfig
|
2016-07-06 06:30:33 +00:00
|
|
|
plugins.smartfile.memory.toFsSync(this.configString, filePath);
|
2016-07-12 21:20:08 +00:00
|
|
|
// get cert
|
|
|
|
certInstanceArg.getDomainCert(this.zoneName)
|
|
|
|
.then(done.resolve);
|
|
|
|
return done.promise;
|
2016-07-21 00:24:54 +00:00
|
|
|
}
|
2016-07-06 06:30:33 +00:00
|
|
|
;
|
2016-07-21 00:24:54 +00:00
|
|
|
}
|
2016-07-06 06:30:33 +00:00
|
|
|
exports.NginxZone = NginxZone;
|
|
|
|
;
|
2016-07-24 23:54:36 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJ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