From 0f8adb6e805aabffc07efc101b45520603d0e6cc Mon Sep 17 00:00:00 2001 From: Ryan Burnette Date: Sun, 12 May 2019 01:36:40 +0000 Subject: [PATCH] Quieter (#13) - quieter now (#2) - fix (#14) --- greenlock-store-sequelize.js | 12 ++++++++++-- package-lock.json | 9 +++++++-- package.json | 3 ++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/greenlock-store-sequelize.js b/greenlock-store-sequelize.js index 5631e7d..b65b1da 100644 --- a/greenlock-store-sequelize.js +++ b/greenlock-store-sequelize.js @@ -1,5 +1,7 @@ 'use strict'; +var mkdirp = require('@root/mkdirp'); + module.exports.create = function (config={}) { var store = { options: {}, @@ -17,9 +19,15 @@ module.exports.create = function (config={}) { // they don't, we'll use the baked-in db with its defaults. Sequelize = require('sequelize'); if (config.storeDatabaseUrl) { - sequelize = new Sequelize(config.storeDatabaseUrl); + sequelize = new Sequelize(config.storeDatabaseUrl, { logging: false }); } else { - sequelize = new Sequelize({ dialect: 'sqlite', storage: confDir + '/db.sqlite3' }); + sequelize = new Promise(function (resolve, reject) { + confDir = confDir.replace(/~\//, require('os').homedir() + '/'); + mkdirp(confDir, function (err) { + if (err) { reject(err); return; } + resolve(new Sequelize({ dialect: 'sqlite', storage: confDir + '/db.sqlite3', logging: false })); + }); + }); } } diff --git a/package-lock.json b/package-lock.json index a620df0..7e2e9a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,9 +1,14 @@ { - "name": "greenlock-store-sequelize", - "version": "1.0.0", + "name": "@greenlock/store-sequelize", + "version": "3.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { + "@root/mkdirp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@root/mkdirp/-/mkdirp-1.0.0.tgz", + "integrity": "sha512-hxGAYUx5029VggfG+U9naAhQkoMSXtOeXtbql97m3Hi6/sQSRL/4khKZPyOF6w11glyCOU38WCNLu9nUcSjOfA==" + }, "@types/node": { "version": "11.13.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.0.tgz", diff --git a/package.json b/package.json index 6a53fe1..a23cddc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@greenlock/store-sequelize", - "version": "3.0.0", + "version": "3.0.1", "description": "A Sequelize-based certificate store for greenlock that supports wildcards.", "homepage": "https://git.rootprojects.org/root/greenlock-store-sequelize.js", "main": "greenlock-store-sequelize.js", @@ -29,6 +29,7 @@ ], "license": "MPL-2.0", "dependencies": { + "@root/mkdirp": "^1.0.0", "sequelize": "^5.2.11" }, "devDependencies": {},