forked from ungleich-public/dynamicweb
Read the secret key from the persisted key file when unset
docker compose exec skips the entrypoint, so commands run that way had no DJANGO_SECRET_KEY. Fall back to the file the entrypoint writes.
This commit is contained in:
parent
fc4532e89b
commit
17bf42c895
1 changed files with 7 additions and 0 deletions
|
|
@ -79,6 +79,13 @@ EMAIL_PORT = int_env("EMAIL_PORT", 25)
|
|||
EMAIL_USE_TLS = bool_env("EMAIL_USE_TLS")
|
||||
|
||||
SECRET_KEY = env('DJANGO_SECRET_KEY')
|
||||
if not SECRET_KEY:
|
||||
# the docker entrypoint persists a generated key here; this lets
|
||||
# "docker compose exec" commands, which skip the entrypoint, find it
|
||||
_key_file = env('SECRET_KEY_FILE', '/data/secret-key')
|
||||
if os.path.exists(_key_file):
|
||||
with open(_key_file) as _f:
|
||||
SECRET_KEY = _f.read().strip()
|
||||
|
||||
# Application definition
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue