Persist secret key in data folder (#620)

* Persist secret key in data folder

* use random secret key by default in prod

* fix e2e test
This commit is contained in:
Sascha Ißbrücker
2024-01-28 23:58:03 +01:00
committed by GitHub
parent 96ee4746ad
commit 38204c87cf
7 changed files with 33 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ Production settings for linkding webapp
# noinspection PyUnresolvedReferences
import os
from django.core.management.utils import get_random_secret_key
from .base import *
# Turn of debug mode
@@ -15,10 +16,10 @@ SASS_PROCESSOR_ENABLED = False
# Try read secret key from file
try:
with open(os.path.join(BASE_DIR, "secretkey.txt")) as f:
with open(os.path.join(BASE_DIR, "data", "secretkey.txt")) as f:
SECRET_KEY = f.read().strip()
except:
pass
SECRET_KEY = get_random_secret_key()
# Set ALLOWED_HOSTS
# By default look in the HOST_NAME environment variable, if that is not set then allow all hosts