diff --git a/conf_script.sh b/conf_script.sh index 4b9fdd3..cff1cc0 100644 --- a/conf_script.sh +++ b/conf_script.sh @@ -1,10 +1,18 @@ #!/bin/bash -if [ -z "$HEROKU_APP_NAME" ]; then - echo "HEROKU_APP_NAME is not set. Exiting." - exit 1 +if [ -n "$HEROKU_APP_ID" ] && [ -n "$HEROKU_APP_NAME" ]; then + APP_URL="https://${HEROKU_APP_NAME}-${HEROKU_APP_ID}.herokuapp.com/" +else + if [ -f /app/app_link.txt ]; then + APP_URL=$(cat /app/app_link.txt) + else + echo "Neither HEROKU_APP_NAME/ID nor /app/app_link.txt is available. Exiting." + exit 1 + fi fi +echo $APP_URL + if [[ $DATABASE_URL =~ ^postgres://([^:]+):([^@]+)@([^:]+):([0-9]+)/([^/]+)$ ]]; then DB_USER="${BASH_REMATCH[1]}" DB_PASS="${BASH_REMATCH[2]}" @@ -15,10 +23,6 @@ else exit 1 fi -APP_URL=$(< /app/app_link.txt) -APP_URL2="https://${HEROKU_APP_NAME}.herokuapp.com/" -echo $APP_URL2 - mkdir -p /var/lib/gitea/custom/conf echo "[server]" > /var/lib/gitea/custom/conf/app.ini