smartnginx/dist/smartnginx.classes.nginxzone.js

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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5jbGFzc2VzLm5naW54em9uZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0bmdpbnguY2xhc3Nlcy5uZ2lueHpvbmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHNCQUFzQixDQUFDLENBQUE7QUFDaEQsTUFBWSxLQUFLLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUU1QyxNQUFZLFFBQVEsV0FBTSx1QkFDMUIsQ0FBQyxDQURnRDtBQUNqRCxXQUFZLFNBQVM7SUFDZCx5REFBWSxDQUFBO0lBQ1osNkNBQU0sQ0FBQTtBQUNiLENBQUMsRUFIVyxpQkFBUyxLQUFULGlCQUFTLFFBR3BCO0FBSEQsSUFBWSxTQUFTLEdBQVQsaUJBR1gsQ0FBQTtBQUVEO0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