- Von 16 .env Dateien auf 2 zentrale reduziert * docker/dev/.env - Development Secrets * docker/prod/.env - Production Secrets - Alle ENV-Variablen jetzt in docker-compose.yml environment sections - .env COPY aus allen Dockerfiles entfernt (wurden durch volume mounts überschrieben) - Frontend env.sh umgeschrieben: Liest ENV-Variablen statt .env Datei - CLIENT_URL komplett entfernt (wurde nirgendwo verwendet) - Fix: management.js nutzt platform_name statt name (DB-Schema korrekt) ENV-Handling jetzt deutlich einfacher und wartbarer! Von 4 Frontend ENV-Variablen auf 3 reduziert (API_URL, PUBLIC_HOST, INTERNAL_HOST)
25 lines
563 B
Bash
Executable File
25 lines
563 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Recreate config file
|
|
rm -rf ./env-config.js
|
|
touch ./env-config.js
|
|
|
|
# Add assignment
|
|
echo "window._env_ = {" >> ./env-config.js
|
|
|
|
# List of environment variables to export (add more as needed)
|
|
ENV_VARS="API_URL PUBLIC_HOST INTERNAL_HOST"
|
|
|
|
# Read each environment variable and add to config
|
|
for varname in $ENV_VARS; do
|
|
# Get value from environment using indirect expansion
|
|
value="${!varname}"
|
|
|
|
# Only add if value exists
|
|
if [ -n "$value" ]; then
|
|
echo " $varname: \"$value\"," >> ./env-config.js
|
|
fi
|
|
done
|
|
|
|
echo "}" >> ./env-config.js
|