Initialize .env in env export templates

This commit is contained in:
Alexandre
2025-12-27 10:16:44 +01:00
parent 54ec5df87d
commit ea25783a73
2 changed files with 12 additions and 2 deletions

View File

@@ -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