File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,27 +18,13 @@ module.exports = {
1818}
1919
2020EOF
21- regex=' postgres:\/\/([^:]+):([^@]+)@([^:]+):([^\/]+)\/(.+)'
2221
23- if [[ $DATABASE_URL =~ $regex ]]; then
24-
25- username=" ${BASH_REMATCH[1]} "
26- password=" ${BASH_REMATCH[2]} "
27- host=" ${BASH_REMATCH[3]} "
28- port=" ${BASH_REMATCH[4]} "
29- database=" ${BASH_REMATCH[5]} "
30-
31- cat << EOF > config.json
22+ cat << EOF > config.json
3223
3324{
3425 "production": {
3526 "db": {
36- "dialect": "postgres",
37- "host": "${host} ",
38- "username": "${username} ",
39- "password": "${password} ",
40- "database": "${database} ",
41- "port": "${port} ",
27+ "database": "${DATABASE_URL} ",
4228 "dialectOptions": {
4329 "ssl": true
4430 }
4733}
4834
4935EOF
50- else
51-
52- cat << EOF > config.json
53-
54- {
55- "production": {
56- }
57- }
58-
59- EOF
60-
61- fi
62-
6336
6437 cp public/js/config.js.example public/js/config.js
6538
Original file line number Diff line number Diff line change @@ -11,7 +11,13 @@ var logger = require("../logger.js");
1111
1212var dbconfig = config . db ;
1313dbconfig . logging = config . debug ? logger . info : false ;
14- var sequelize = new Sequelize ( dbconfig . database , dbconfig . username , dbconfig . password , dbconfig ) ;
14+
15+ var sequelize ;
16+ if ( typeof dbconfig . username === 'undefined' && typeof dbconfig . password === 'undefined' ) {
17+ sequelize = new Sequelize ( dbconfig . database , dbconfig ) ;
18+ } else {
19+ sequelize = new Sequelize ( dbconfig . database , dbconfig . username , dbconfig . password , dbconfig ) ;
20+ }
1521
1622var db = { } ;
1723
@@ -34,4 +40,4 @@ Object.keys(db).forEach(function (modelName) {
3440db . sequelize = sequelize ;
3541db . Sequelize = Sequelize ;
3642
37- module . exports = db ;
43+ module . exports = db ;
You can’t perform that action at this time.
0 commit comments