bugfixes for defaults

This commit is contained in:
AJ ONeal 2019-11-19 02:24:09 -07:00
parent a5d0cde282
commit e3153c5c8b
5 changed files with 20 additions and 10 deletions

View File

@ -4,6 +4,7 @@ var P = require('../plugins.js');
var args = process.argv.slice(3);
var cli = require('./lib/cli.js');
var Init = require('../lib/init.js');
var Greenlock = require('../');
var Flags = require('./lib/flags.js');
@ -44,16 +45,17 @@ cli.main(async function(argList, flags) {
}
}
var opts = Init._init({
var greenlock = Greenlock.create({
packageRoot: pkgRoot,
manager: flags.manager,
maintainerEmail: flags.maintainerEmail,
_mustPackage: true
});
await greenlock.manager.defaults();
//writeGreenlockJs(pkgdir, flags);
writeServerJs(opts.packageRoot, flags);
writeAppJs(opts.packageRoot);
writeServerJs(pkgRoot, flags);
writeAppJs(pkgRoot);
/*
rc._bin_mode = true;

View File

@ -2,9 +2,9 @@
var Flags = module.exports;
var path = require('path');
//var path = require('path');
var pkgRoot = process.cwd();
var Init = require('../../lib/init.js');
//var Init = require('../../lib/init.js');
// These are ALL options
// The individual CLI files each select a subset of them

View File

@ -5,6 +5,7 @@ var pkg = require('./package.json');
var ACME = require('@root/acme');
var Greenlock = module.exports;
var request = require('@root/request');
var process = require('process');
var G = Greenlock;
var U = require('./utils.js');
@ -566,8 +567,13 @@ function mergeDefaults(MCONF, gconf) {
console.info('[default] renewStagger: ' + MCONF.renewStagger);
}
var vers = process.versions.node.split('.');
var defaultKeyType = 'EC-P256';
if (vers[0] < 10 || (vers[0] === '10' && vers[1] < '12')) {
defaultKeyType = 'RSA-2048';
}
if (!MCONF.accountKeyType) {
MCONF.accountKeyType = gconf.accountKeyType || 'EC-P256';
MCONF.accountKeyType = gconf.accountKeyType || defaultKeyType;
console.info('[default] accountKeyType: ' + MCONF.accountKeyType);
}
if (!MCONF.serverKeyType) {
@ -587,6 +593,7 @@ function mergeDefaults(MCONF, gconf) {
gconf.agreeToTerms ||
'(show notice on use)')
);
console.info('');
}
}

View File

@ -88,7 +88,7 @@ Init._init = function(opts) {
myPkg.author =
(realPkg.author && realPkg.author.email) || realPkg.author;
}
if (opts._init) {
if (!opts._init) {
opts.maintainerEmail = myPkg.author;
}
}
@ -102,7 +102,7 @@ Init._init = function(opts) {
throw new Error(msgErr);
}
if (opts._init) {
if (!opts._init) {
opts.maintainerEmail = parseMaintainer(opts.maintainerEmail);
if (!opts.maintainerEmail) {
msgErr =

View File

@ -34,8 +34,9 @@ Rc._initSync = function(dirname, manager, configDir) {
if (manager) {
if (rc.manager) {
if (
rc.manager !== manager ||
rc.manager.module !== manager.module
('string' === typeof rc.manager && rc.manager !== manager) ||
('string' !== typeof rc.manager &&
rc.manager.module !== manager.module)
) {
changed = true;
console.info(