summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/config.js7
-rw-r--r--lib/models/index.js4
2 files changed, 5 insertions, 6 deletions
diff --git a/lib/config.js b/lib/config.js
index 9e8aa337..f8df0a73 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -24,10 +24,8 @@ var allowanonymous = process.env.HMD_ALLOW_ANONYMOUS ? (process.env.HMD_ALLOW_AN
var allowfreeurl = process.env.HMD_ALLOW_FREEURL ? (process.env.HMD_ALLOW_FREEURL === 'true') : !!config.allowfreeurl;
// db
-var db = config.db || {
- dialect: 'sqlite',
- storage: './db.hackmd.sqlite'
-};
+var dburl = config.dburl || process.env.HMD_DB_URL || process.env.DATABASE_URL;
+var db = config.db || {};
// ssl path
var sslkeypath = config.sslkeypath || '';
@@ -131,6 +129,7 @@ module.exports = {
usecdn: usecdn,
allowanonymous: allowanonymous,
allowfreeurl: allowfreeurl,
+ dburl: dburl,
db: db,
sslkeypath: path.join(cwd, sslkeypath),
sslcertpath: path.join(cwd, sslcertpath),
diff --git a/lib/models/index.js b/lib/models/index.js
index 6fcffb5f..de6cd13c 100644
--- a/lib/models/index.js
+++ b/lib/models/index.js
@@ -15,8 +15,8 @@ dbconfig.logging = config.debug ? logger.info : false;
var sequelize = null;
// Heroku specific
-if (process.env.DATABASE_URL)
- sequelize = new Sequelize(process.env.DATABASE_URL);
+if (config.dburl)
+ sequelize = new Sequelize(config.dburl, dbconfig);
else
sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig);