Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
06256f7a4d | |||
be6fc3adfd | |||
5ccf5b81e2 | |||
d06a2cee2f | |||
a7525184ef | |||
ae9865749a | |||
b2482b3cfd | |||
41988da3ed |
1
dist/cert.paths.d.ts
vendored
1
dist/cert.paths.d.ts
vendored
@ -3,4 +3,5 @@ export declare let config: string;
|
|||||||
export declare let leShConfig: string;
|
export declare let leShConfig: string;
|
||||||
export declare let letsencryptSh: string;
|
export declare let letsencryptSh: string;
|
||||||
export declare let certDir: string;
|
export declare let certDir: string;
|
||||||
|
export declare let defaultSslDir: string;
|
||||||
export declare let assetDir: string;
|
export declare let assetDir: string;
|
||||||
|
7
dist/cert.paths.js
vendored
7
dist/cert.paths.js
vendored
@ -6,6 +6,7 @@ exports.config = plugins.path.join(__dirname, "assets/config.json");
|
|||||||
exports.leShConfig = plugins.path.join(__dirname, "assets/leshconfig.json");
|
exports.leShConfig = plugins.path.join(__dirname, "assets/leshconfig.json");
|
||||||
exports.letsencryptSh = plugins.path.join(__dirname, "assets/letsencrypt.sh");
|
exports.letsencryptSh = plugins.path.join(__dirname, "assets/letsencrypt.sh");
|
||||||
//dirs
|
//dirs
|
||||||
exports.certDir = plugins.path.join(__dirname, "/assets/certs");
|
exports.certDir = plugins.path.join(__dirname, "assets/certs");
|
||||||
exports.assetDir = plugins.path.join(__dirname, "/assets/");
|
exports.defaultSslDir = plugins.path.join(__dirname, "assets/defaultSslDir");
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5wYXRocy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2NlcnQucGF0aHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLGdCQUFnQixDQUFDLENBQUE7QUFFMUMsUUFBUTtBQUNHLGdCQUFRLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQy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JQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBQyx3QkFBd0IsQ0FBQyxDQUFDO0FBQ25FLHFCQUFhLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFDLHVCQUF1QixDQUFDLENBQUM7QUFFaEYsTUFBTTtBQUNLLGVBQU8sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUMsY0FBYyxDQUFDLENBQUM7QUFDdEQscUJBQWEsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUMsc0JBQXNCLENBQUMsQ0FBQztBQUNwRSxnQkFBUSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBQyxTQUFTLENBQUMsQ0FBQyJ9
|
15
dist/index.d.ts
vendored
15
dist/index.d.ts
vendored
@ -1,5 +1,12 @@
|
|||||||
/// <reference types="q" />
|
/// <reference types="q" />
|
||||||
import * as plugins from "./cert.plugins";
|
import * as plugins from "./cert.plugins";
|
||||||
|
export interface ICertConstructorOptions {
|
||||||
|
cfEmail: string;
|
||||||
|
cfKey: string;
|
||||||
|
sslDir?: string;
|
||||||
|
gitOriginRepo?: string;
|
||||||
|
testMode?: boolean;
|
||||||
|
}
|
||||||
export declare class Cert {
|
export declare class Cert {
|
||||||
private _cfEmail;
|
private _cfEmail;
|
||||||
private _cfKey;
|
private _cfKey;
|
||||||
@ -8,13 +15,7 @@ export declare class Cert {
|
|||||||
private _testMode;
|
private _testMode;
|
||||||
certificatesPresent: Certificate[];
|
certificatesPresent: Certificate[];
|
||||||
certificatesValid: Certificate[];
|
certificatesValid: Certificate[];
|
||||||
constructor(optionsArg: {
|
constructor(optionsArg: ICertConstructorOptions);
|
||||||
cfEmail: string;
|
|
||||||
cfKey: string;
|
|
||||||
sslDir: string;
|
|
||||||
gitOriginRepo?: string;
|
|
||||||
testMode?: boolean;
|
|
||||||
});
|
|
||||||
sslGitOriginPull: () => void;
|
sslGitOriginPull: () => void;
|
||||||
sslGitOriginAddCommitPush: () => void;
|
sslGitOriginAddCommitPush: () => void;
|
||||||
getDomainCert(domainNameArg: string, optionsArg?: {
|
getDomainCert(domainNameArg: string, optionsArg?: {
|
||||||
|
7
dist/index.js
vendored
7
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cert",
|
"name": "cert",
|
||||||
"version": "0.0.13",
|
"version": "0.0.17",
|
||||||
"description": "Easily obain SSL certificates from LetsEncrypt. Supports DNS-01 challenge. TypeScript ready.",
|
"description": "Easily obain SSL certificates from LetsEncrypt. Supports DNS-01 challenge. TypeScript ready.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
@ -27,9 +27,9 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/cert#readme",
|
"homepage": "https://gitlab.com/pushrocks/cert#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/minimatch": "^2.0.26-alpha",
|
"@types/minimatch": "*",
|
||||||
"@types/q": "0.0.25-alpha",
|
"@types/q": "*",
|
||||||
"@types/shelljs": "^0.3.25-alpha",
|
"@types/shelljs": "*",
|
||||||
"beautylog": "^5.0.13",
|
"beautylog": "^5.0.13",
|
||||||
"cflare": "0.0.9",
|
"cflare": "0.0.9",
|
||||||
"fs-extra": "^0.30.0",
|
"fs-extra": "^0.30.0",
|
||||||
|
@ -18,7 +18,7 @@ describe("cert", function () {
|
|||||||
});
|
});
|
||||||
describe("Cert", function () {
|
describe("Cert", function () {
|
||||||
it("should create a new Cert object from class", function () {
|
it("should create a new Cert object from class", function () {
|
||||||
this.timeout(20000);
|
this.timeout(40000);
|
||||||
testCert = new cert.Cert({
|
testCert = new cert.Cert({
|
||||||
cfEmail: process.env.CF_EMAIL,
|
cfEmail: process.env.CF_EMAIL,
|
||||||
cfKey: process.env.CF_KEY,
|
cfKey: process.env.CF_KEY,
|
||||||
@ -30,7 +30,7 @@ describe("cert", function () {
|
|||||||
});
|
});
|
||||||
it("should get a valid certificate", function (done) {
|
it("should get a valid certificate", function (done) {
|
||||||
this.timeout(120000);
|
this.timeout(120000);
|
||||||
testCert.getDomainCert("hello2.bleu.de").then(function () {
|
testCert.getDomainCert("hello4.bleu.de").then(function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -22,7 +22,7 @@ describe("cert",function(){
|
|||||||
})
|
})
|
||||||
describe("Cert",function(){
|
describe("Cert",function(){
|
||||||
it("should create a new Cert object from class",function(){
|
it("should create a new Cert object from class",function(){
|
||||||
this.timeout(20000);
|
this.timeout(40000);
|
||||||
testCert = new cert.Cert({
|
testCert = new cert.Cert({
|
||||||
cfEmail: process.env.CF_EMAIL,
|
cfEmail: process.env.CF_EMAIL,
|
||||||
cfKey: process.env.CF_KEY,
|
cfKey: process.env.CF_KEY,
|
||||||
@ -34,7 +34,7 @@ describe("cert",function(){
|
|||||||
})
|
})
|
||||||
it("should get a valid certificate",function(done){
|
it("should get a valid certificate",function(done){
|
||||||
this.timeout(120000);
|
this.timeout(120000);
|
||||||
testCert.getDomainCert("hello2.bleu.de").then(() => {
|
testCert.getDomainCert("hello4.bleu.de").then(() => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -7,5 +7,6 @@ export let leShConfig = plugins.path.join(__dirname,"assets/leshconfig.json");
|
|||||||
export let letsencryptSh = plugins.path.join(__dirname,"assets/letsencrypt.sh");
|
export let letsencryptSh = plugins.path.join(__dirname,"assets/letsencrypt.sh");
|
||||||
|
|
||||||
//dirs
|
//dirs
|
||||||
export let certDir = plugins.path.join(__dirname,"/assets/certs");
|
export let certDir = plugins.path.join(__dirname,"assets/certs");
|
||||||
export let assetDir = plugins.path.join(__dirname,"/assets/");
|
export let defaultSslDir = plugins.path.join(__dirname,"assets/defaultSslDir");
|
||||||
|
export let assetDir = plugins.path.join(__dirname,"assets/");
|
19
ts/index.ts
19
ts/index.ts
@ -1,6 +1,14 @@
|
|||||||
import * as plugins from "./cert.plugins";
|
import * as plugins from "./cert.plugins";
|
||||||
import * as paths from "./cert.paths";
|
import * as paths from "./cert.paths";
|
||||||
|
|
||||||
|
export interface ICertConstructorOptions {
|
||||||
|
cfEmail: string,
|
||||||
|
cfKey: string,
|
||||||
|
sslDir?: string,
|
||||||
|
gitOriginRepo?: string,
|
||||||
|
testMode?: boolean
|
||||||
|
};
|
||||||
|
|
||||||
export class Cert {
|
export class Cert {
|
||||||
private _cfEmail: string;
|
private _cfEmail: string;
|
||||||
private _cfKey: string;
|
private _cfKey: string;
|
||||||
@ -9,13 +17,7 @@ export class Cert {
|
|||||||
private _testMode: boolean
|
private _testMode: boolean
|
||||||
certificatesPresent: Certificate[];
|
certificatesPresent: Certificate[];
|
||||||
certificatesValid: Certificate[];
|
certificatesValid: Certificate[];
|
||||||
constructor(optionsArg: {
|
constructor(optionsArg:ICertConstructorOptions) {
|
||||||
cfEmail: string,
|
|
||||||
cfKey: string,
|
|
||||||
sslDir: string,
|
|
||||||
gitOriginRepo?: string,
|
|
||||||
testMode?: boolean
|
|
||||||
}) {
|
|
||||||
this._cfEmail = optionsArg.cfEmail;
|
this._cfEmail = optionsArg.cfEmail;
|
||||||
this._cfKey = optionsArg.cfKey;
|
this._cfKey = optionsArg.cfKey;
|
||||||
this._sslDir = optionsArg.sslDir;
|
this._sslDir = optionsArg.sslDir;
|
||||||
@ -30,6 +32,8 @@ export class Cert {
|
|||||||
JSON.stringify(config),
|
JSON.stringify(config),
|
||||||
plugins.path.join(__dirname, "assets/config.json")
|
plugins.path.join(__dirname, "assets/config.json")
|
||||||
);
|
);
|
||||||
|
// setup sslDir
|
||||||
|
if (!this._sslDir) this._sslDir = paths.defaultSslDir;
|
||||||
// setup Git
|
// setup Git
|
||||||
if (this._gitOriginRepo) {
|
if (this._gitOriginRepo) {
|
||||||
plugins.smartgit.init(this._sslDir);
|
plugins.smartgit.init(this._sslDir);
|
||||||
@ -73,6 +77,7 @@ export class Cert {
|
|||||||
let fetchedCertsArray: string[] = plugins.smartfile.fs.listFoldersSync(paths.certDir);
|
let fetchedCertsArray: string[] = plugins.smartfile.fs.listFoldersSync(paths.certDir);
|
||||||
if (fetchedCertsArray.indexOf(domainNameArg) != -1) {
|
if (fetchedCertsArray.indexOf(domainNameArg) != -1) {
|
||||||
updateSslDirSync(this._sslDir, domainNameArg);
|
updateSslDirSync(this._sslDir, domainNameArg);
|
||||||
|
plugins.smartfile.fs.removeSync(plugins.path.join(paths.certDir,domainNameArg));
|
||||||
}
|
}
|
||||||
this.sslGitOriginAddCommitPush();
|
this.sslGitOriginAddCommitPush();
|
||||||
done.resolve();
|
done.resolve();
|
||||||
|
Reference in New Issue
Block a user