switch to new storage strategy...

This commit is contained in:
Philipp Kunz 2016-10-24 03:26:34 +02:00
parent 944fbc071b
commit 7455891097
3 changed files with 19 additions and 16 deletions

View File

@ -1,8 +1,12 @@
"use strict";
const q = require("q");
let letsencrypt = require('letsencrypt');
const plugins = require("./cert.plugins");
const paths = require("./cert.paths");
let letsencrypt = require('letsencrypt');
let leStore = require('le-store-certbot').create({
configDir: paths.leConfigDir,
debug: false
});
class Letsencrypt {
constructor(optionsArg) {
// determine leEnv
@ -20,19 +24,16 @@ class Letsencrypt {
this._leInstance = letsencrypt.create({
server: this._leServerUrl,
challenges: {
'dns-01': this._leChallengeHandler(),
'dns-01': this._leChallengeHandler()
},
challengeType: 'dns-01',
configDir: paths.leConfigDir,
privkeyPath: ':configDir/live/:hostname/privkey.pem',
fullchainPath: ':configDir/live/:hostname/fullchain.pem',
certPath: ':configDir/live/:hostname/cert.pem',
chainPath: ':configDir/live/:hostname/chain.pem',
store: leStore,
agreeToTerms: (opts, agreeCb) => {
agreeCb(null, opts.tosUrl);
},
debug: true
});
console.log();
}
/**
* register a domain
@ -100,7 +101,7 @@ class Letsencrypt {
});
},
loopback: (defaults, domain, challenge, done) => {
cb();
done();
},
test: (defaults, domain, challenge, cb) => {
cb();
@ -109,4 +110,4 @@ class Letsencrypt {
}
}
exports.Letsencrypt = Letsencrypt;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5jbGFzc2VzLmxldHNlbmNyeXB0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvY2VydC5jbGFzc2VzLmxldHNlbmNyeXB0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSx1QkFBc0I7QUFDdEIsSUFBSSxXQUFXLEdBQUcsT0FBTyxDQUFDLGFBQWEsQ0FBQyxDQUFBO0FBRXhDLDBDQUF5QztBQUN6QyxzQ0FBcUM7QUFZckM7SUFRSSxZQUFZLFVBQTBD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RUFBRSxTQUFTLEVBQUUsRUFBRTtnQkFDbEMsRUFBRSxFQUFFLENBQUE7WUFDUixDQUFDO1NBQ0osQ0FBQTtJQUNMLENBQUM7Q0FDSjtBQXBIRCxrQ0FvSEMifQ==

View File

@ -31,6 +31,7 @@
"beautylog": "^6.0.0",
"cflare": "0.0.10",
"fs-extra": "^0.30.0",
"le-store-certbot": "^2.0.3",
"letsencrypt": "^2.1.8",
"lik": "^1.0.24",
"q": "^1.4.1",

View File

@ -1,5 +1,6 @@
import * as q from 'q'
let letsencrypt = require('letsencrypt')
let leStore = require('le-store-certbot')
import * as plugins from './cert.plugins'
import * as paths from './cert.paths'
@ -39,19 +40,19 @@ export class Letsencrypt {
this._leInstance = letsencrypt.create({
server: this._leServerUrl,
challenges: {
'dns-01': this._leChallengeHandler(),
'dns-01': this._leChallengeHandler()
},
challengeType: 'dns-01',
configDir: paths.leConfigDir,
privkeyPath: ':configDir/live/:hostname/privkey.pem',
fullchainPath: ':configDir/live/:hostname/fullchain.pem',
certPath: ':configDir/live/:hostname/cert.pem',
chainPath: ':configDir/live/:hostname/chain.pem',
store: leStore.create({
configDir: paths.leConfigDir,
debug: true
}),
agreeToTerms: (opts, agreeCb) => {
agreeCb(null, opts.tosUrl)
},
debug: true
})
console.log()
}
/**
@ -126,7 +127,7 @@ export class Letsencrypt {
})
},
loopback: (defaults, domain, challenge, done) => {
cb()
done()
},
test: (defaults, domain, challenge, cb) => {
cb()