-
Notifications
You must be signed in to change notification settings - Fork 2
/
dataplane-boot.sh
executable file
·40 lines (33 loc) · 982 Bytes
/
dataplane-boot.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
#!/bin/sh
set -euo pipefail
case "${DP_CREDENTIAL_TYPE:-}" in
static)
# read from a token file
readonly token_file="${SBOOT_TOKEN_FILE:-}"
if [[ -z "${token_file}" ]]; then
echo "missing required env var SBOOT_TOKEN_FILE" >&2
exit 1
fi
if [[ ! -f "${token_file}" ]]; then
echo "token file does not exist yet: ${token_file}" >&2
exit 1
fi
token=""
set +e
read -r token < "${token_file}"
set -e
# trim any whitespace; this overdoes it in the middle, but tokens don't have
# whitespace in the middle so :shrug:
token="${token//[[:space:]]}"
export DP_CREDENTIAL_STATIC_TOKEN="${token}"
;;
*)
;;
esac
# if [[ -n "${DP_CA_CERTS:-}" ]]; then
# mkdir -p /tmp/ca
# cp "${DP_CA_CERTS}/consul-agent-ca.pem" /tmp/ca
# export DP_CA_CERTS="/tmp/ca"
# fi
env | sort
exec consul-dataplane "$@"