From f84dcade8004cfe92a5227f710f716944fa94f16 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 17 Nov 2021 20:07:02 +0100 Subject: [PATCH] Update entrypoint.sh --- enedisgateway2mqtt/rootfs/entrypoint.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/enedisgateway2mqtt/rootfs/entrypoint.sh b/enedisgateway2mqtt/rootfs/entrypoint.sh index 0e11bd2bb..c4649a817 100644 --- a/enedisgateway2mqtt/rootfs/entrypoint.sh +++ b/enedisgateway2mqtt/rootfs/entrypoint.sh @@ -1,5 +1,24 @@ #!/bin/bash +################################### +# Export all addon options as env # +################################### + +# For all keys in options.json +JSONSOURCE="/data/options.json" + +# Export keys as env variables +mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE}) +for KEYS in ${arr[@]}; do + # export key + export $(echo "${KEYS}=$(jq .$KEYS ${JSONSOURCE})") + echo "All addon configs exported as env variables" +done + +#################### +# Starting scripts # +#################### + echo "Starting scripts :" for SCRIPTS in scripts/*; do [ -e "$SCRIPTS" ] || continue