- quieter now (#2)
- fix (#14)
This commit is contained in:
Ryan Burnette 2019-05-12 01:36:40 +00:00 committed by Gitea
parent db2b0ec82f
commit 0f8adb6e80
3 changed files with 19 additions and 5 deletions

View File

@ -1,5 +1,7 @@
'use strict'; 'use strict';
var mkdirp = require('@root/mkdirp');
module.exports.create = function (config={}) { module.exports.create = function (config={}) {
var store = { var store = {
options: {}, options: {},
@ -17,9 +19,15 @@ module.exports.create = function (config={}) {
// they don't, we'll use the baked-in db with its defaults. // they don't, we'll use the baked-in db with its defaults.
Sequelize = require('sequelize'); Sequelize = require('sequelize');
if (config.storeDatabaseUrl) { if (config.storeDatabaseUrl) {
sequelize = new Sequelize(config.storeDatabaseUrl); sequelize = new Sequelize(config.storeDatabaseUrl, { logging: false });
} else { } 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 }));
});
});
} }
} }

9
package-lock.json generated
View File

@ -1,9 +1,14 @@
{ {
"name": "greenlock-store-sequelize", "name": "@greenlock/store-sequelize",
"version": "1.0.0", "version": "3.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "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": { "@types/node": {
"version": "11.13.0", "version": "11.13.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.0.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.0.tgz",

View File

@ -1,6 +1,6 @@
{ {
"name": "@greenlock/store-sequelize", "name": "@greenlock/store-sequelize",
"version": "3.0.0", "version": "3.0.1",
"description": "A Sequelize-based certificate store for greenlock that supports wildcards.", "description": "A Sequelize-based certificate store for greenlock that supports wildcards.",
"homepage": "https://git.rootprojects.org/root/greenlock-store-sequelize.js", "homepage": "https://git.rootprojects.org/root/greenlock-store-sequelize.js",
"main": "greenlock-store-sequelize.js", "main": "greenlock-store-sequelize.js",
@ -29,6 +29,7 @@
], ],
"license": "MPL-2.0", "license": "MPL-2.0",
"dependencies": { "dependencies": {
"@root/mkdirp": "^1.0.0",
"sequelize": "^5.2.11" "sequelize": "^5.2.11"
}, },
"devDependencies": {}, "devDependencies": {},