boot.sh 839 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. set -euxo pipefail
  3. # This file will store the config env variables needed by the app
  4. readonly CONF=/build/env.config
  5. # EMAIL_URL can also be set here by injecting another env variable in the template
  6. # ROOT_URL can also be set at runtime, by querying AWS api or by using ingress annotations in the template for k8s.
  7. cat >"${CONF}" <<'EOF'
  8. export MONGO_URL=mongodb://{{DATABASE_USER}}:{{DATABASE_PASSWORD}}@{{DATABASE_HOST}}:{{DATABASE_PORT}}/{{DATABASE_NAME}}
  9. export ROOT_URL=http://localhost
  10. export PORT=3000
  11. EOF
  12. sed -i -e "s/{{DATABASE_USER}}/${DATABASE_USER}/" "${CONF}"
  13. sed -i -e "s/{{DATABASE_PASSWORD}}/${DATABASE_PASSWORD}/" "${CONF}"
  14. sed -i -e "s/{{DATABASE_HOST}}/${DATABASE_HOST}/" "${CONF}"
  15. sed -i -e "s/{{DATABASE_PORT}}/${DATABASE_PORT}/" "${CONF}"
  16. sed -i -e "s/{{DATABASE_NAME}}/${DATABASE_NAME}/" "${CONF}"