aboutsummaryrefslogtreecommitdiffstats
path: root/prod_bootstrap.sh
blob: c1de9266ff59d1e2d4583f2700bda4bace9ff47d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

set -euo pipefail
DIR="${1}"
VALID_ENV_KEYS=$(printenv | awk -F '=' '{ print $1 }' | tail | awk 'NF')

for f in $(find ${DIR} -regex '.*\.js'); do
  for envKey in ${VALID_ENV_KEYS}; do
    replaced=$(printenv ${envKey})
    sed -i "s|%${envKey}|${replaced}|g" "${f}"
    echo "[bootstrap] Replaced ${envKey} from container environment."
  done
done

nginx -g "daemon off;"