38 lines
4.7 KiB
JavaScript
38 lines
4.7 KiB
JavaScript
"use strict";
|
|
var plugins = require("./cert.plugins");
|
|
var paths = require("./cert.paths");
|
|
var Cert = (function () {
|
|
function Cert(optionsArg) {
|
|
this.cfEmail = optionsArg.cfEmail;
|
|
this.cfKey = optionsArg.cfKey;
|
|
this.sslDir = optionsArg.sslDir;
|
|
this.gitOriginRepo = optionsArg.gitOriginRepo;
|
|
var config = {
|
|
cfEmail: this.cfEmail,
|
|
cfKey: this.cfKey
|
|
};
|
|
plugins.smartfile.memory.toFsSync(JSON.stringify(config), { fileName: "config.json", filePath: plugins.path.join(__dirname, "assets/") });
|
|
}
|
|
;
|
|
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 + "\"");
|
|
done.resolve();
|
|
return done.promise;
|
|
};
|
|
;
|
|
return Cert;
|
|
}());
|
|
exports.Cert = Cert;
|
|
var Certificate = (function () {
|
|
function Certificate() {
|
|
}
|
|
;
|
|
return Certificate;
|
|
}());
|
|
exports.Certificate = Certificate;
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxnQkFBZ0IsQ0FBQyxDQUFBO0FBQzFDLElBQVksS0FBSyxXQUFNLGNBQWMsQ0FBQyxDQUFBO0FBRXRDO0lBT0ksY0FBWSxVQUtYO1FBQ0csSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsT0FBTyxDQUFDO1FBQ2xDLElBQUksQ0FBQyxLQUFLLEdBQUcsVUFBV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jb25maWcgPSB7XG4gICAgICAgICAgICBjZkVtYWlsOiB0aGlzLmNmRW1haWwsXG4gICAgICAgICAgICBjZktleTogdGhpcy5jZktleVxuICAgICAgICB9XG4gICAgICAgIHBsdWdpbnMuc21hcnRmaWxlLm1lbW9yeS50b0ZzU3luYyhKU09OLnN0cmluZ2lmeShjb25maWcpLHtmaWxlTmFtZTpcImNvbmZpZy5qc29uXCIsZmlsZVBhdGg6cGx1Z2lucy5wYXRoLmpvaW4oX19kaXJuYW1lLFwiYXNzZXRzL1wiKX0pO1xuICAgIH07XG4gICAgZ2V0RG9tYWluQ2VydChkb21haW5OYW1lQXJnOnN0cmluZyl7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIHBsdWdpbnMuc2hlbGxqcy5leGVjKFwiY2htb2QgNzAwIFwiICsgcGF0aHMubGV0c2VuY3J5cHRTaCk7XG4gICAgICAgIHBsdWdpbnMuc2hlbGxqcy5leGVjKFwiY2htb2QgNzAwIFwiICsgcGF0aHMuY2VydEhvb2spO1xuICAgICAgICBwbHVnaW5zLnNoZWxsanMuZXhlYyhcImJhc2ggLWMgXFxcIlwiICsgcGF0aHMubGV0c2VuY3J5cHRTaCArIFwiIC1jIC1kIFwiICsgZG9tYWluTmFtZUFyZyArIFwiIC10IGRucy0wMSAtayBcIiArIHBhdGhzLmNlcnRIb29rICsgXCIgLW8gXCIrIHBhdGhzLnNzbERpciArIFwiXFxcIlwiKTtcbiAgICAgICAgZG9uZS5yZXNvbHZlKCk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfTtcbn1cblxuZXhwb3J0IGNsYXNzIENlcnRpZmljYXRlIHtcbiAgICBkb21haW5OYW1lOnN0cmluZztcbiAgICBjcmVhdGlvbkRhdGU6RGF0ZTtcbiAgICBleHBpcnlEYXRlOkRhdGU7XG4gICAgY29uc3RydWN0b3IoKXtcblxuICAgIH07XG59Il19
|