summaryrefslogtreecommitdiffstats
path: root/stacksmith/user-scripts/boot.sh
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2018-12-18 20:23:43 +0200
committerLauri Ojansivu <x@xet7.org>2018-12-18 20:23:43 +0200
commit61c02920891b95e7d0779848ebe4f6b3d516592c (patch)
treecdee0f25362e47d6ea8f10301d4e959e777e2163 /stacksmith/user-scripts/boot.sh
parentc8173fd9f9d220c7de40c9b7ecdca34d97181f26 (diff)
parent2fbcf7e9b61702a2c3311f813de2bb12a754b2b2 (diff)
downloadwekan-61c02920891b95e7d0779848ebe4f6b3d516592c.tar.gz
wekan-61c02920891b95e7d0779848ebe4f6b3d516592c.tar.bz2
wekan-61c02920891b95e7d0779848ebe4f6b3d516592c.zip
Merge branch 'edge' into meteor-1.8
Diffstat (limited to 'stacksmith/user-scripts/boot.sh')
-rwxr-xr-xstacksmith/user-scripts/boot.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/stacksmith/user-scripts/boot.sh b/stacksmith/user-scripts/boot.sh
new file mode 100755
index 00000000..bd95102f
--- /dev/null
+++ b/stacksmith/user-scripts/boot.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+set -euxo pipefail
+
+# This file will store the config env variables needed by the app
+readonly CONF=/build/env.config
+
+# EMAIL_URL can also be set here by injecting another env variable in the template
+# ROOT_URL can also be set at runtime, by querying AWS api or by using ingress annotations in the template for k8s.
+
+cat >"${CONF}" <<'EOF'
+export MONGO_URL=mongodb://{{DATABASE_USER}}:{{DATABASE_PASSWORD}}@{{DATABASE_HOST}}:{{DATABASE_PORT}}/{{DATABASE_NAME}}
+export ROOT_URL=http://localhost
+export PORT=3000
+EOF
+
+sed -i -e "s/{{DATABASE_USER}}/${DATABASE_USER}/" "${CONF}"
+sed -i -e "s/{{DATABASE_PASSWORD}}/${DATABASE_PASSWORD}/" "${CONF}"
+sed -i -e "s/{{DATABASE_HOST}}/${DATABASE_HOST}/" "${CONF}"
+sed -i -e "s/{{DATABASE_PORT}}/${DATABASE_PORT}/" "${CONF}"
+sed -i -e "s/{{DATABASE_NAME}}/${DATABASE_NAME}/" "${CONF}"
+