-
Notifications
You must be signed in to change notification settings - Fork 9
/
entrypoint.sh
executable file
·50 lines (41 loc) · 1.45 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
46
47
48
49
50
#!/bin/bash
set -e
if [[ -z "$TRUSTIFY_API_URL" ]]; then
echo "You must provide TRUSTIFY_API_URL environment variable" 1>&2
exit 1
fi
if [[ $AUTH_REQUIRED != "false" ]]; then
if [[ -z "$OIDC_CLIENT_ID" ]]; then
echo "You must provide OIDC_CLIENT_ID environment variable" 1>&2
exit 1
fi
if [[ -z "$OIDC_SERVER_URL" ]]; then
echo "You must provide OIDC_SERVER_URL environment variable" 1>&2
exit 1
fi
fi
if [[ $ANALYTICS_ENABLED != "false" ]]; then
if [[ -z "$ANALYTICS_WRITE_KEY" ]]; then
echo "You must provide ANALYTICS_WRITE_KEY environment variable" 1>&2
exit 1
fi
fi
if [[ -z "${NODE_EXTRA_CA_CERTS}" ]]; then
# Nothing to do
echo "No NODE_EXTRA_CA_CERTS found"
else
# Copy the Kube API and service CA bundle to /opt/app-root/src/ca.crt if they exist
# Add Kube API CA
if [ -f "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" ]; then
cp /var/run/secrets/kubernetes.io/serviceaccount/ca.crt ${NODE_EXTRA_CA_CERTS}
fi
# Add service serving CA
if [ -f "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt" ]; then
cat /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt >>${NODE_EXTRA_CA_CERTS}
fi
# Add custom ingress CA if it exists
if [ -f "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" ]; then
cat /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem >>${NODE_EXTRA_CA_CERTS}
fi
fi
exec node --enable-source-maps server/dist/index.js