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 args = process.argv.slice(3);
var cli = require('./lib/cli.js'); var cli = require('./lib/cli.js');
var Init = require('../lib/init.js'); var Init = require('../lib/init.js');
var Greenlock = require('../');
var Flags = require('./lib/flags.js'); 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, packageRoot: pkgRoot,
manager: flags.manager, manager: flags.manager,
maintainerEmail: flags.maintainerEmail, maintainerEmail: flags.maintainerEmail,
_mustPackage: true _mustPackage: true
}); });
await greenlock.manager.defaults();
//writeGreenlockJs(pkgdir, flags); //writeGreenlockJs(pkgdir, flags);
writeServerJs(opts.packageRoot, flags); writeServerJs(pkgRoot, flags);
writeAppJs(opts.packageRoot); writeAppJs(pkgRoot);
/* /*
rc._bin_mode = true; rc._bin_mode = true;

View File

@ -2,9 +2,9 @@
var Flags = module.exports; var Flags = module.exports;
var path = require('path'); //var path = require('path');
var pkgRoot = process.cwd(); var pkgRoot = process.cwd();
var Init = require('../../lib/init.js'); //var Init = require('../../lib/init.js');
// These are ALL options // These are ALL options
// The individual CLI files each select a subset of them // 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 ACME = require('@root/acme');
var Greenlock = module.exports; var Greenlock = module.exports;
var request = require('@root/request'); var request = require('@root/request');
var process = require('process');
var G = Greenlock; var G = Greenlock;
var U = require('./utils.js'); var U = require('./utils.js');
@ -566,8 +567,13 @@ function mergeDefaults(MCONF, gconf) {
console.info('[default] renewStagger: ' + MCONF.renewStagger); 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) { if (!MCONF.accountKeyType) {
MCONF.accountKeyType = gconf.accountKeyType || 'EC-P256'; MCONF.accountKeyType = gconf.accountKeyType || defaultKeyType;
console.info('[default] accountKeyType: ' + MCONF.accountKeyType); console.info('[default] accountKeyType: ' + MCONF.accountKeyType);
} }
if (!MCONF.serverKeyType) { if (!MCONF.serverKeyType) {
@ -587,6 +593,7 @@ function mergeDefaults(MCONF, gconf) {
gconf.agreeToTerms || gconf.agreeToTerms ||
'(show notice on use)') '(show notice on use)')
); );
console.info('');
} }
} }

View File

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

View File

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