From 9ea7961bb608fa2b3d10c6b5e7a9bceeecda0567 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 5 Nov 2019 15:38:08 -0700 Subject: [PATCH] v3.1.4: bugfix basePath for issue #13 --- greenlock.js | 17 ++++++++++------- greenlockrc.js | 2 +- package.json | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/greenlock.js b/greenlock.js index 4240467..e5d7863 100644 --- a/greenlock.js +++ b/greenlock.js @@ -405,7 +405,8 @@ G.create = function(gconf) { showDir = true; dirUrl = greenlock._defaults.directoryUrl; } - if (showDir || /staging/.test(dirUrl)) { + if (showDir || (/staging/.test(dirUrl) && !gdefaults.shownDirectory)) { + gdefaults.shownDirectory = true; console.info('ACME Directory URL:', gdefaults.directoryUrl); } @@ -446,13 +447,15 @@ G.create = function(gconf) { var storeConf = siteConf.store || mconf.store; storeConf = JSON.parse(JSON.stringify(storeConf)); storeConf.packageRoot = gconf.packageRoot; - if (storeConf.basePath) { - var path = require('path'); - storeConf.basePath = path.resolve( - gconf.packageRoot || process.cwd(), - 'greenlock' - ); + + var path = require('path'); + if (!storeConf.basePath) { + storeConf.basePath = 'greenlock'; } + storeConf.basePath = path.resolve( + gconf.packageRoot || process.cwd(), + storeConf.basePath + ); return P._loadStore(storeConf).then(function(store) { return A._getOrCreate( greenlock, diff --git a/greenlockrc.js b/greenlockrc.js index 54d602c..1720580 100644 --- a/greenlockrc.js +++ b/greenlockrc.js @@ -162,7 +162,7 @@ module.exports._read = function(pkgdir) { throw err; } try { - require(path.join(pkgdir, 'package.json')); + require(path.resolve(path.join(pkgdir, './package.json'))); } catch (e) { e.context = 'package.json'; e.desc = diff --git a/package.json b/package.json index f3581ad..e2fc12d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@root/greenlock", - "version": "3.1.3", + "version": "3.1.4", "description": "The easiest Let's Encrypt client for Node.js and Browsers", "homepage": "https://rootprojects.org/greenlock/", "main": "greenlock.js",