Merge pull request #277 from hackmdio/heroku-sequelize
Fix heroku production postgres setting
This commit is contained in:
commit
159be6a7c7
2 changed files with 14 additions and 3 deletions
|
@ -19,10 +19,16 @@ module.exports = {
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat << EOF > config.json
|
cat << EOF > config.json
|
||||||
|
|
||||||
{
|
{
|
||||||
"production": {
|
"production": {
|
||||||
|
"db": {
|
||||||
|
"database": "${DATABASE_URL}",
|
||||||
|
"dialectOptions": {
|
||||||
|
"ssl": true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,12 @@ var logger = require("../logger.js");
|
||||||
|
|
||||||
var dbconfig = config.db;
|
var dbconfig = config.db;
|
||||||
dbconfig.logging = config.debug ? logger.info : false;
|
dbconfig.logging = config.debug ? logger.info : false;
|
||||||
var sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig);
|
|
||||||
|
var sequelize = null;
|
||||||
|
if (dbconfig.hasOwnProperty('username') || dbconfig.hasOwnProperty('password'))
|
||||||
|
sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig);
|
||||||
|
else
|
||||||
|
sequelize = new Sequelize(dbconfig.database, dbconfig);
|
||||||
|
|
||||||
var db = {};
|
var db = {};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue