summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorYukai Huang2016-12-11 12:07:46 +0800
committerYukai Huang2016-12-12 08:58:37 +0800
commit50b72c7f03ebf47a78ed303c7d0d41bf278dedba (patch)
tree3d9f7e3a43e4d4f7d4ebafffe37211a714576532 /bin
parent9769b0c872b3a8c6774799f2ddb4e76b07c02bdd (diff)
Fix heroku production db setting
Diffstat (limited to 'bin')
-rwxr-xr-xbin/heroku35
1 files changed, 34 insertions, 1 deletions
diff --git a/bin/heroku b/bin/heroku
index f30b2b23..b0d0797a 100755
--- a/bin/heroku
+++ b/bin/heroku
@@ -18,8 +18,38 @@ module.exports = {
}
EOF
+ regex='postgres:\/\/([^:]+):([^@]+)@([^:]+):([^\/]+)\/(.+)'
- cat << EOF > config.json
+ if [[ $DATABASE_URL =~ $regex ]]; then
+
+ username="${BASH_REMATCH[1]}"
+ password="${BASH_REMATCH[2]}"
+ host="${BASH_REMATCH[3]}"
+ port="${BASH_REMATCH[4]}"
+ database="${BASH_REMATCH[5]}"
+
+ cat << EOF > config.json
+
+{
+ "production": {
+ "db": {
+ "dialect": "postgres",
+ "host": "${host}",
+ "username": "${username}",
+ "password": "${password}",
+ "database": "${database}",
+ "port": "${port}",
+ "dialectOptions": {
+ "ssl": true
+ }
+ }
+ }
+}
+
+EOF
+ else
+
+ cat << EOF > config.json
{
"production": {
@@ -28,6 +58,9 @@ EOF
EOF
+ fi
+
+
cp public/js/config.js.example public/js/config.js
# build app