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,8 +18,38 @@ module.exports = {
1818}
1919
2020EOF
21+ regex=' postgres:\/\/([^:]+):([^@]+)@([^:]+):([^\/]+)\/(.+)'
2122
22- cat << EOF > config.json
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
32+
33+ {
34+ "production": {
35+ "db": {
36+ "dialect": "postgres",
37+ "host": "${host} ",
38+ "username": "${username} ",
39+ "password": "${password} ",
40+ "database": "${database} ",
41+ "port": "${port} ",
42+ "dialectOptions": {
43+ "ssl": true
44+ }
45+ }
46+ }
47+ }
48+
49+ EOF
50+ else
51+
52+ cat << EOF > config.json
2353
2454{
2555 "production": {
2858
2959EOF
3060
61+ fi
62+
63+
3164 cp public/js/config.js.example public/js/config.js
3265
3366 # build app
You can’t perform that action at this time.
0 commit comments