mirror of
https://github.com/rommapp/romm.git
synced 2026-12-02 10:08:40 +01:00
Fix ROMM_AUTH_SECRET_KEY auto-generation under nounset
The init script runs with `set -o nounset`, so testing `${ROMM_AUTH_SECRET_KEY}`
aborted with "unbound variable" before reaching the generation branch, leaving
the container in a restart loop. This only triggered when the variable was
omitted entirely; shipping it with an empty value took the working path.
Use `${ROMM_AUTH_SECRET_KEY-}` so the unset case is testable, and warn instead
of info since a generated key changes on every restart.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -332,9 +332,9 @@ if ! printenv | grep -q '^OTEL_'; then
|
||||
fi
|
||||
|
||||
# Set ROMM_AUTH_SECRET_KEY if not already set
|
||||
if [[ -z ${ROMM_AUTH_SECRET_KEY} ]]; then
|
||||
if [[ -z ${ROMM_AUTH_SECRET_KEY-} ]]; then
|
||||
ROMM_AUTH_SECRET_KEY=$(python3 -c "import secrets; print(secrets.token_hex(32))")
|
||||
info_log "ROMM_AUTH_SECRET_KEY not set, generating random secret key"
|
||||
warn_log "ROMM_AUTH_SECRET_KEY not set, generating a random secret key. It changes on every restart, invalidating API bearer tokens and pending invite/password-reset links. Set it explicitly to keep those valid, and always set it when running more than one replica."
|
||||
export ROMM_AUTH_SECRET_KEY
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user