mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-09 01:11:04 +01:00
Initialize .env in env export templates
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user