Update env example and settings configuration.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# IMPORTANT: must match the FunZone backend SECRET_KEY so admin JWTs validate here.
|
# IMPORTANT: must match the FunZone backend SECRET_KEY so admin JWTs validate here.
|
||||||
SECRET_KEY=your-super-secret-key-change-in-production
|
# Generate: python -c "import secrets; print(secrets.token_urlsafe(50))"
|
||||||
|
# App will refuse to start if this is missing or still a placeholder.
|
||||||
|
SECRET_KEY=
|
||||||
|
|
||||||
DEBUG=True
|
DEBUG=True
|
||||||
ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0,testserver
|
ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0,testserver
|
||||||
|
|||||||
@@ -14,7 +14,20 @@ from decouple import config
|
|||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
# Must match the FunZone backend SECRET_KEY so admin JWTs validate here.
|
# Must match the FunZone backend SECRET_KEY so admin JWTs validate here.
|
||||||
SECRET_KEY = config('SECRET_KEY', default='your-super-secret-key-change-in-production')
|
# Refuse known insecure placeholders so the app cannot boot with a forgeable JWT key.
|
||||||
|
_INSECURE_SECRET_KEYS = frozenset({
|
||||||
|
'',
|
||||||
|
'your-super-secret-key-change-in-production',
|
||||||
|
'your-super-secret-key-change-in-production-please-use-a-strong-key',
|
||||||
|
'your-super-secret-key-change-in-production-use-openssl-rand-base64-32',
|
||||||
|
})
|
||||||
|
SECRET_KEY = config('SECRET_KEY', default='')
|
||||||
|
if SECRET_KEY.strip() in _INSECURE_SECRET_KEYS:
|
||||||
|
raise ValueError(
|
||||||
|
'SECRET_KEY is missing or insecure. Set a strong random value in .env '
|
||||||
|
'(must match funzone-backend). Generate with: '
|
||||||
|
'python -c "import secrets; print(secrets.token_urlsafe(50))"'
|
||||||
|
)
|
||||||
|
|
||||||
DEBUG = config('DEBUG', default=True, cast=bool)
|
DEBUG = config('DEBUG', default=True, cast=bool)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user