2016-06-18 14:03:46 +00:00
|
|
|
"use strict";
|
2016-06-22 11:22:09 +00:00
|
|
|
var plugins = require("./cert.plugins");
|
|
|
|
var paths = require("./cert.paths");
|
2016-06-18 14:03:46 +00:00
|
|
|
var Cert = (function () {
|
|
|
|
function Cert(optionsArg) {
|
|
|
|
this.cfEmail = optionsArg.cfEmail;
|
|
|
|
this.cfKey = optionsArg.cfKey;
|
|
|
|
this.sslDir = optionsArg.sslDir;
|
|
|
|
this.gitOriginRepo = optionsArg.gitOriginRepo;
|
2016-06-22 11:22:09 +00:00
|
|
|
var config = {
|
|
|
|
cfEmail: this.cfEmail,
|
|
|
|
cfKey: this.cfKey
|
|
|
|
};
|
|
|
|
plugins.smartfile.memory.toFsSync(JSON.stringify(config), { fileName: "config.json", filePath: plugins.path.join(__dirname, "assets/") });
|
2016-06-18 14:03:46 +00:00
|
|
|
}
|
|
|
|
;
|
2016-06-22 11:22:09 +00:00
|
|
|
Cert.prototype.getDomainCert = function (domainNameArg) {
|
|
|
|
var done = plugins.q.defer();
|
|
|
|
plugins.shelljs.exec("chmod 700 " + paths.letsencryptSh);
|
|
|
|
plugins.shelljs.exec("chmod 700 " + paths.certHook);
|
|
|
|
plugins.shelljs.exec("bash -c \"" + paths.letsencryptSh + " -c -d " + domainNameArg + " -t dns-01 -k " + paths.certHook + " -o " + paths.sslDir + "\"");
|
2016-06-22 11:35:15 +00:00
|
|
|
done.resolve();
|
2016-06-22 11:22:09 +00:00
|
|
|
return done.promise;
|
|
|
|
};
|
2016-06-18 14:03:46 +00:00
|
|
|
;
|
|
|
|
return Cert;
|
|
|
|
}());
|
|
|
|
exports.Cert = Cert;
|
|
|
|
var Certificate = (function () {
|
|
|
|
function Certificate() {
|
|
|
|
}
|
|
|
|
;
|
|
|
|
return Certificate;
|
|
|
|
}());
|
|
|
|
exports.Certificate = Certificate;
|
2016-06-18 13:07:54 +00:00
|
|
|
|
2016-06-22 11:35:15 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=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Ib29rICsgXCIgLW8gXCIrIHBhdGhzLnNzbERpciArIFwiXFxcIlwiKTtcbiAgICAgICAgZG9uZS5yZXNvbHZlKCk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfTtcbn1cblxuZXhwb3J0IGNsYXNzIENlcnRpZmljYXRlIHtcbiAgICBkb21haW5OYW1lOnN0cmluZztcbiAgICBjcmVhdGlvbkRhdGU6RGF0ZTtcbiAgICBleHBpcnlEYXRlOkRhdGU7XG4gICAgY29uc3RydWN0b3IoKXtcblxuICAgIH07XG59Il19
|