From cfc0474deb9511b5afac16518f376a9497b32ff1 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sat, 12 Nov 2022 21:00:01 +0100 Subject: [PATCH] Universal variables for python --- .templates/90-config_yaml.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.templates/90-config_yaml.sh b/.templates/90-config_yaml.sh index 18915bb42..1260472d2 100644 --- a/.templates/90-config_yaml.sh +++ b/.templates/90-config_yaml.sh @@ -112,6 +112,12 @@ while IFS= read -r line; do sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null || true sed -i "1a export $line" /scripts/*run* 2>/dev/null || true + # export on python + if command -v "python3" &>/dev/null; then + [ ! -f /env.py ] && echo "import os" > /env.py + echo "os.environ['${line%%=*}'] = '${line#*=}'" >> /env.py + python3 /env.py + fi # Show in log if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi else