diff --git a/README.md b/README.md index 60b8182..84fa5b5 100644 --- a/README.md +++ b/README.md @@ -74,19 +74,17 @@ Install npm install --save greenlock@2.x ``` - **Optional** dependency for *more efficient* RSA key generation: +(important for those on ARM devices like Raspberry Pi) ```bash npm install --save ursa ``` -(important for those on ARM devices like Raspberry Pi) **Optional** dependency for *Let's Encrypt v01* (pre-draft ACME spec) compatibility: +(important for those on ARM devices like Raspberry Pi) ```bash npm install --save le-acme-core ``` -(important for those on ARM devices like Raspberry Pi) - ### Production vs Staging diff --git a/index.js b/index.js index dbb5a45..8f607e5 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,12 @@ var DAY = 24 * 60 * 60 * 1000; //var MIN = 60 * 1000; var ACME = require('acme-v2/compat').ACME; +var PromiseA; +try { + PromiseA = require('bluebird'); +} catch(e) { + PromiseA = global.Promise; +} var Greenlock = module.exports; Greenlock.Greenlock = Greenlock; @@ -70,8 +76,6 @@ Greenlock._undefine = function (gl) { return gl; }; Greenlock.create = function (gl) { - var PromiseA = require('bluebird'); - gl.store = gl.store || require('le-store-certbot').create({ debug: gl.debug , configDir: gl.configDir diff --git a/lib/core.js b/lib/core.js index e7e8dd5..586e1eb 100644 --- a/lib/core.js +++ b/lib/core.js @@ -1,5 +1,12 @@ 'use strict'; +var PromiseA; +try { + PromiseA = require('bluebird'); +} catch(e) { + PromiseA = global.Promise; +} + function _log(debug) { if (debug) { var args = Array.prototype.slice.call(arguments); @@ -10,7 +17,6 @@ function _log(debug) { } module.exports.create = function (gl) { - var PromiseA = require('bluebird'); var utils = require('./utils'); var RSA = PromiseA.promisifyAll(require('rsa-compat').RSA); var log = gl.log || _log; // allow custom log diff --git a/package.json b/package.json index 4027d88..9e1eae8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "greenlock", - "version": "2.2.20", + "version": "2.3.0", "description": "Let's Encrypt for node.js on npm", "main": "index.js", "scripts": { @@ -57,9 +57,10 @@ "devDependencies": { "request": "^2.75.0" }, - "optionalDependencies": { + "trulyOptionalDependencies": { "bluebird": "^3.5.1", - "le-acme-core": "^2.1.3" + "le-acme-core": "^2.1.3", + "ursa": "^0.9.4" }, "dependencies": { "acme": "^1.0.6", @@ -71,7 +72,7 @@ "le-store-certbot": "^2.1.0", "node.extend": "^1.1.5", "pkijs": "^1.3.27", - "rsa-compat": "^1.3.2" + "rsa-compat": "^1.4.0" }, "engines": { "node": ">=4.5"