smartnginx/dist/smartnginx.classes.nginxzone.js
2016-07-25 01:54:36 +02:00

32 lines
2.6 KiB
JavaScript

"use strict";
const plugins = require("./smartnginx.plugins");
const paths = require("./smartnginx.paths");
const snippets = require("./smartnginx.snippets");
(function (zoneTypes) {
zoneTypes[zoneTypes["reverseProxy"] = 0] = "reverseProxy";
zoneTypes[zoneTypes["static"] = 1] = "static";
})(exports.zoneTypes || (exports.zoneTypes = {}));
var zoneTypes = exports.zoneTypes;
class NginxZone {
constructor(optionsArg) {
this.zoneName = optionsArg.zoneName;
this.type = optionsArg.type;
this.destination = optionsArg.destination;
this.configString = snippets.getZoneConfigString(optionsArg.zoneName, optionsArg.destination);
}
;
deploy(certInstanceArg) {
let done = plugins.q.defer();
let filePath = plugins.path.join(paths.nginxZoneBase, this.zoneName + ".conf");
// writeConfig
plugins.smartfile.memory.toFsSync(this.configString, filePath);
// get cert
certInstanceArg.getDomainCert(this.zoneName)
.then(done.resolve);
return done.promise;
}
;
}
exports.NginxZone = NginxZone;
;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5jbGFzc2VzLm5naW54em9uZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0bmdpbnguY2xhc3Nlcy5uZ2lueHpvbmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHNCQUFzQixDQUFDLENBQUE7QUFDaEQsTUFBWSxLQUFLLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUM1QyxNQUFZLFFBQVEsV0FBTSx1QkFDMUIsQ0FBQyxDQURnRDtBQUNqRCxXQUFZLFNBQVM7SUFDakIseURBQVksQ0FBQTtJQUNaLDZDQUFNLENBQUE7QUFDVixDQUFDLEVBSFcsaUJBQVMsS0FBVCxpQkFBUyxRQUdwQjtBQUhELElBQVksU0FBUyxHQUFULGlCQUdYLENBQ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