defaults for secret and greenlock

This commit is contained in:
AJ ONeal 2018-05-25 01:13:05 +00:00
parent 4b38c27a71
commit ce70c75378
1 changed files with 8 additions and 2 deletions

View File

@ -46,7 +46,7 @@ function applyConfig(config) {
state.config = config; state.config = config;
state.servernames = config.servernames || []; state.servernames = config.servernames || [];
state.secret = state.config.secret; state.secret = state.config.secret;
if (state.secret) { if (!state.secret) {
state.secret = require('crypto').randomBytes(16).toString('hex'); state.secret = require('crypto').randomBytes(16).toString('hex');
console.info(""); console.info("");
console.info("Secret for this session:"); console.info("Secret for this session:");
@ -55,6 +55,12 @@ function applyConfig(config) {
console.info(""); console.info("");
console.info(""); console.info("");
} }
if (!state.config.greenlock) {
state.config.greenlock = {};
}
if (!state.config.greenlock.configDir) {
state.config.greenlock.configDir = require('os').homedir() + require('path').sep + 'acme';
}
function approveDomains(opts, certs, cb) { function approveDomains(opts, certs, cb) {
console.log('[debug] approveDomains', opts.domains); console.log('[debug] approveDomains', opts.domains);
@ -122,7 +128,7 @@ function applyConfig(config) {
, approveDomains: approveDomains , approveDomains: approveDomains
, configDir: '/root/acme' , configDir: state.config.configDir
, debug: true , debug: true
//, approvedDomains: program.servernames //, approvedDomains: program.servernames