make PUBLIC_DOMAIN dependent on the environment where it is deployed

This commit is contained in:
Philip Henning 2025-01-28 20:17:02 +01:00
parent 22e4ddcb46
commit c7cb342c77
2 changed files with 16 additions and 13 deletions

View file

@ -1,6 +1,6 @@
# SETTINGS from env.template # SETTINGS from env.template
# Misc configuration # Misc configuration
PUBLIC_DOMAIN=sso.base23.de PUBLIC_DOMAIN=replace-me
COMPOSE_PROJECT_NAME=sso-base23-de COMPOSE_PROJECT_NAME=sso-base23-de
# Auhtentik version # Auhtentik version

View file

@ -36,10 +36,12 @@ while true; do
case "$DEPLOYMENT_ENVIRONMENT" in case "$DEPLOYMENT_ENVIRONMENT" in
[Pp]* ) [Pp]* )
DEPLOYMENT_ENVIRONMENT="PRODUCTION" DEPLOYMENT_ENVIRONMENT="PRODUCTION"
PUBLIC_DOMAIN="sso.base23.de"
break break
;; ;;
[Tt]* ) [Tt]* )
DEPLOYMENT_ENVIRONMENT="TEST" DEPLOYMENT_ENVIRONMENT="TEST"
PUBLIC_DOMAIN="sso.test.base23.de"
break break
;; ;;
* ) * )
@ -51,6 +53,7 @@ done
# Check if .env exists and exit if it is # Check if .env exists and exit if it is
if [[ ! -f ./.env ]]; then if [[ ! -f ./.env ]]; then
cat ./env.template >> ./.env cat ./env.template >> ./.env
sed -i 's/\(PUBLIC_DOMAIN=\).*/\1${PUBLIC_DOMAIN}/' ./.env
echo "# SECRETS" >> ./.env echo "# SECRETS" >> ./.env
echo "PG_PASS=$(openssl rand -base64 36 | tr -d '\n')" >> ./.env echo "PG_PASS=$(openssl rand -base64 36 | tr -d '\n')" >> ./.env
echo "AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60 | tr -d '\n')" >> ./.env echo "AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60 | tr -d '\n')" >> ./.env