mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +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 ""
|
echo ""
|
||||||
|
|
||||||
JSONSOURCE="/data/options.json"
|
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)
|
# Define secrets location (optional)
|
||||||
SECRETSOURCE=""
|
SECRETSOURCE=""
|
||||||
@@ -233,7 +238,7 @@ export_option() {
|
|||||||
printf '%s' "${value}" > "/var/run/s6/container_environment/${key}"
|
printf '%s' "${value}" > "/var/run/s6/container_environment/${key}"
|
||||||
fi
|
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
|
mkdir -p /etc
|
||||||
echo "${key}=$(dotenv_quote "$value")" >> /etc/environment 2>/dev/null || true
|
echo "${key}=$(dotenv_quote "$value")" >> /etc/environment 2>/dev/null || true
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ if [[ "$CONFIGSOURCE" != *".yaml" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Permissions only if the config file already exists
|
||||||
if [[ "$CONFIGSOURCE" == *".yaml" ]] && [ -f "$CONFIGSOURCE" ]; then
|
if [[ "$CONFIGSOURCE" == *".yaml" ]] && [ -f "$CONFIGSOURCE" ]; then
|
||||||
echo "Setting permissions for the config.yaml directory"
|
echo "Setting permissions for the config.yaml directory"
|
||||||
@@ -174,7 +179,7 @@ while IFS= read -r line; do
|
|||||||
python3 /env.py
|
python3 /env.py
|
||||||
fi
|
fi
|
||||||
# set .env
|
# set .env
|
||||||
echo "$line" >> /.env
|
echo "$line" >> "$ENV_FILE"
|
||||||
# set environment
|
# set environment
|
||||||
mkdir -p /etc
|
mkdir -p /etc
|
||||||
echo "$line" >> /etc/environment
|
echo "$line" >> /etc/environment
|
||||||
|
|||||||
Reference in New Issue
Block a user