-
Notifications
You must be signed in to change notification settings - Fork 3
/
entrypoint.sh
executable file
·45 lines (40 loc) · 1.24 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
set -euxo pipefail
# DANGER: defaulting to prod is ok for F&F but shouldn't
# stay like this for too long.
APP_ENVIRONMENT="${APP_ENVIRONMENT:-production}"
export APP_ENVIRONMENT
# At present, owing to the ITRB setup, we do not control app launch
# definitions. To mitigate the impact of this, we expect only a single
# env var defining the environment, and set our required variables on
# the basis of that. This is not an ideal pattern but will do for now.
#
case "$APP_ENVIRONMENT" in
production)
config_file="configurations/production.json"
;;
test)
config_file="configurations/test.json"
;;
ci)
config_file="configurations/ci.json"
;;
dev)
config_file="configurations/dev.json"
;;
*)
echo "Unexpected value $APP_ENVIRONMENT for APP_ENVIRONMENT"
;;
esac
# If a cmdline arg is provided, override the env var-sourced
# configuration file.
if [ $# -ge 1 ]; then
echo "Overriding env var-driven config file with explicitly supplied file"
config_file="$1"
fi
if [ $# -eq 2 ]; then
echo "Using additional override file $2"
node -r newrelic StartServer.mjs "$config_file" "$2"
else
node -r newrelic StartServer.mjs "$config_file"
fi