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
# Misc configuration
PUBLIC_DOMAIN=sso.base23.de
PUBLIC_DOMAIN=replace-me
COMPOSE_PROJECT_NAME=sso-base23-de
# Auhtentik version

View file

@ -34,23 +34,26 @@ AUTHENTIK_DOCKER_COMPOSE_PATH="$(realpath "$(pwd)")"
while true; do
read -p "Do you want to init a [P]roduction or [T]est environment? (P/T): " DEPLOYMENT_ENVIRONMENT
case "$DEPLOYMENT_ENVIRONMENT" in
[Pp]* )
DEPLOYMENT_ENVIRONMENT="PRODUCTION"
break
;;
[Tt]* )
DEPLOYMENT_ENVIRONMENT="TEST"
break
;;
* )
echo "Please answer with P or T."
;;
esac
[Pp]* )
DEPLOYMENT_ENVIRONMENT="PRODUCTION"
PUBLIC_DOMAIN="sso.base23.de"
break
;;
[Tt]* )
DEPLOYMENT_ENVIRONMENT="TEST"
PUBLIC_DOMAIN="sso.test.base23.de"
break
;;
* )
echo "Please answer with P or T."
;;
esac
done
# Check if .env exists and exit if it is
if [[ ! -f ./.env ]]; then
cat ./env.template >> ./.env
sed -i 's/\(PUBLIC_DOMAIN=\).*/\1${PUBLIC_DOMAIN}/' ./.env
echo "# SECRETS" >> ./.env
echo "PG_PASS=$(openssl rand -base64 36 | tr -d '\n')" >> ./.env
echo "AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60 | tr -d '\n')" >> ./.env