From fa8d1d76b3847990397de93b98efddad525328eb Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 31 Oct 2019 06:20:49 -0600 Subject: [PATCH] init before renew --- greenlock.js | 6 ++++-- plugins.js | 12 ++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/greenlock.js b/greenlock.js index 8409e2e..f65dcc5 100644 --- a/greenlock.js +++ b/greenlock.js @@ -261,8 +261,10 @@ G.create = function(gconf) { // needs to get info about the renewal, such as which store and challenge(s) to use greenlock.renew = function(args) { - return manager.defaults().then(function(mconf) { - return greenlock._renew(mconf, args); + return greenlock._init().then(function() { + return manager.defaults().then(function(mconf) { + return greenlock._renew(mconf, args); + }); }); }; greenlock._renew = function(mconf, args) { diff --git a/plugins.js b/plugins.js index 09a5a00..678f5f4 100644 --- a/plugins.js +++ b/plugins.js @@ -187,14 +187,22 @@ P._normalizeChallenge = function(name, ch) { }; P._loadSync = function(modname) { - var mod; + try { + return require(modname); + } catch (e) { + console.error("Could not load '%s'", modname); + console.error('Did you install it?'); + console.error('\tnpm install --save %s', modname); + throw e; + } + /* try { mod = require(modname); } catch (e) { P._installSync(modname); mod = require(modname); } - return mod; + */ }; P._installSync = function(moduleName) {