From 98703012ef7a718e720fef8ca946b08b97b93cf2 Mon Sep 17 00:00:00 2001 From: James Swineson Date: Fri, 17 Apr 2020 23:18:26 -0700 Subject: [PATCH] allow RXTXRPT option to be set via Docker env var --- entrypoint.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 3279288..981b95a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,27 @@ #!/usr/bin/env bash set -Eeuo pipefail +CONFIG_FILE="/var/atlas-probe/state/config.txt" +declare -a OPTIONS=( + "RXTXRPT" +) + +# create essential files and fix permission +mkdir -p /var/atlas-probe/status chown -R atlas:atlas /var/atlas-probe/status +mkdir -p /var/atlas-probe/etc chown -R atlas:atlas /var/atlas-probe/etc +mkdir -p /var/atlas-probe/state +chown -R atlas:atlas /var/atlas-probe/state +echo "" > "${CONFIG_FILE}" + +# set probe configuration +for OPT in "${OPTIONS[@]}"; do + if [ ! -z "${!OPT+x}" ]; then + echo "Option ${OPT}=${!OPT}" + echo "${OPT}=${!OPT}" >> "${CONFIG_FILE}" + fi +done exec gosu atlas:atlas "$@" +