25 lines
689 B
Bash
25 lines
689 B
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
: "${RPKI_FRR_RPKI_HOST:=127.0.0.1}"
|
|
: "${RPKI_FRR_RPKI_PORT:=323}"
|
|
: "${RPKI_FRR_RPKI_PREFERENCE:=1}"
|
|
: "${RPKI_FRR_CONFIG_TEMPLATE_PATH:=/config/frr.conf.template}"
|
|
: "${RPKI_FRR_CONFIG_PATH:=/etc/frr/frr.conf}"
|
|
|
|
escape_sed() {
|
|
printf '%s' "$1" | sed 's/[&|\\]/\\&/g'
|
|
}
|
|
|
|
host="$(escape_sed "${RPKI_FRR_RPKI_HOST}")"
|
|
port="$(escape_sed "${RPKI_FRR_RPKI_PORT}")"
|
|
preference="$(escape_sed "${RPKI_FRR_RPKI_PREFERENCE}")"
|
|
|
|
sed \
|
|
-e "s|\${RPKI_FRR_RPKI_HOST}|${host}|g" \
|
|
-e "s|\${RPKI_FRR_RPKI_PORT}|${port}|g" \
|
|
-e "s|\${RPKI_FRR_RPKI_PREFERENCE}|${preference}|g" \
|
|
"${RPKI_FRR_CONFIG_TEMPLATE_PATH}" > "${RPKI_FRR_CONFIG_PATH}"
|
|
|
|
exec /usr/lib/frr/docker-start
|