diff --git a/.templates/00-global_var.sh b/.templates/00-global_var.sh index 73159b953..dcb60d392 100755 --- a/.templates/00-global_var.sh +++ b/.templates/00-global_var.sh @@ -14,6 +14,11 @@ bashio::log.notice "Additional informations : https://github.com/alexbelgium/has echo "" JSONSOURCE="/data/options.json" +ENV_FILE="/.env" + +if [[ ! -f "$ENV_FILE" ]]; then + printf '# Generated by 00-global_var.sh from %s\n' "$JSONSOURCE" > "$ENV_FILE" +fi # Define secrets location (optional) SECRETSOURCE="" @@ -233,7 +238,7 @@ export_option() { printf '%s' "${value}" > "/var/run/s6/container_environment/${key}" fi - echo "${key}=$(dotenv_quote "$value")" >> "/.env" 2>/dev/null || true + echo "${key}=$(dotenv_quote "$value")" >> "$ENV_FILE" 2>/dev/null || true mkdir -p /etc echo "${key}=$(dotenv_quote "$value")" >> /etc/environment 2>/dev/null || true diff --git a/.templates/01-config_yaml.sh b/.templates/01-config_yaml.sh index 646209562..9cff28cd0 100755 --- a/.templates/01-config_yaml.sh +++ b/.templates/01-config_yaml.sh @@ -74,6 +74,11 @@ if [[ "$CONFIGSOURCE" != *".yaml" ]]; then exit 1 fi +ENV_FILE="/.env" +if [[ ! -f "$ENV_FILE" ]]; then + printf '# Generated by 01-config_yaml.sh from %s\n' "$CONFIGSOURCE" > "$ENV_FILE" +fi + # Permissions only if the config file already exists if [[ "$CONFIGSOURCE" == *".yaml" ]] && [ -f "$CONFIGSOURCE" ]; then echo "Setting permissions for the config.yaml directory" @@ -174,7 +179,7 @@ while IFS= read -r line; do python3 /env.py fi # set .env - echo "$line" >> /.env + echo "$line" >> "$ENV_FILE" # set environment mkdir -p /etc echo "$line" >> /etc/environment