v4.0.4: bugfixes for custom / local manager file

This commit is contained in:
AJ ONeal 2020-01-13 16:14:16 -07:00
parent d78e437ec0
commit 6dc711b880
5 changed files with 48 additions and 11 deletions

View File

@ -5,14 +5,20 @@ var args = process.argv.slice(2);
var arg0 = args[0]; var arg0 = args[0];
//console.log(args); //console.log(args);
var found = ['certonly', 'add', 'update', 'config', 'defaults', 'remove', 'init'].some( var found = [
function(k) { 'certonly',
'add',
'update',
'config',
'defaults',
'remove',
'init'
].some(function(k) {
if (k === arg0) { if (k === arg0) {
require('./' + k); require('./' + k);
return true; return true;
} }
} });
);
if (!found) { if (!found) {
console.error(arg0 + ': command not yet implemented'); console.error(arg0 + ': command not yet implemented');

View File

@ -36,6 +36,9 @@ cli.main(async function(argList, flags) {
flags.manager.module = manager; flags.manager.module = manager;
try { try {
if ('.' === String(manager)[0]) {
manager = require('path').resolve(pkgRoot, manager);
}
P._loadSync(manager); P._loadSync(manager);
} catch (e) { } catch (e) {
try { try {

View File

@ -12,13 +12,25 @@ module.exports.wrap = function(greenlock, gconf) {
var myFind = gconf.find; var myFind = gconf.find;
delete gconf.find; delete gconf.find;
var mega = mergeManager(gconf); var mega = mergeManager(greenlock, gconf);
greenlock.manager = {}; greenlock.manager = {};
greenlock.sites = {}; greenlock.sites = {};
//greenlock.accounts = {}; //greenlock.accounts = {};
//greenlock.certs = {}; //greenlock.certs = {};
greenlock.manager._modulename = gconf.manager.module;
if ('/' === String(gconf.manager.module)[0]) {
greenlock.manager._modulename = require('path').relative(
gconf.packageRoot,
greenlock.manager._modulename
);
if ('.' !== String(greenlock.manager._modulename)[0]) {
greenlock.manager._modulename =
'./' + greenlock.manager._modulename;
}
}
var allowed = [ var allowed = [
'accountKeyType', //: ["P-256", "RSA-2048"], 'accountKeyType', //: ["P-256", "RSA-2048"],
'serverKeyType', //: ["RSA-2048", "P-256"], 'serverKeyType', //: ["RSA-2048", "P-256"],
@ -409,6 +421,7 @@ function loadManager(gconf) {
); );
} }
*/ */
try { try {
// wrap this to be safe for @greenlock/manager // wrap this to be safe for @greenlock/manager
m = require(gconf.manager.module).create(gconf.manager); m = require(gconf.manager.module).create(gconf.manager);
@ -431,7 +444,7 @@ function loadManager(gconf) {
return m; return m;
} }
function mergeManager(gconf) { function mergeManager(greenlock, gconf) {
var mng; var mng;
function m() { function m() {
if (mng) { if (mng) {
@ -554,6 +567,21 @@ function mergeManager(gconf) {
mega.get = m().get; mega.get = m().get;
} }
if (!mega.find) {
mega._nofind = false;
mega.find = async function(opts) {
if (!mega._nofind) {
console.warn(
'Warning: manager `' +
greenlock.manager._modulename +
'` does not implement `find({})`\n'
);
mega._nofind = true;
}
return [];
};
}
if (!mega.get) { if (!mega.get) {
mega.get = function(opts) { mega.get = function(opts) {
var servername = opts.servername; var servername = opts.servername;

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@root/greenlock", "name": "@root/greenlock",
"version": "4.0.3", "version": "4.0.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@root/greenlock", "name": "@root/greenlock",
"version": "4.0.3", "version": "4.0.4",
"description": "The easiest Let's Encrypt client for Node.js and Browsers", "description": "The easiest Let's Encrypt client for Node.js and Browsers",
"homepage": "https://rootprojects.org/greenlock/", "homepage": "https://rootprojects.org/greenlock/",
"main": "greenlock.js", "main": "greenlock.js",