core/settings.py

30 lines
931 B
Python
Raw Permalink Normal View History

2023-12-24 14:25:57 +00:00
import sys
2024-01-25 19:41:27 +00:00
from os import environ
2025-03-20 09:24:30 +00:00
MODE = "development" if "dev" in sys.argv else "production"
DEV_SERVER_PID_FILE_NAME = "dev-server.pid"
PORT = environ.get("PORT") or 8000
# storages
2022-09-03 10:50:14 +00:00
DB_URL = (
2024-04-17 15:32:23 +00:00
environ.get("DATABASE_URL", "").replace("postgres://", "postgresql://")
or environ.get("DB_URL", "").replace("postgres://", "postgresql://")
2025-02-09 19:26:50 +00:00
or "sqlite:///discoursio.db"
2022-09-03 10:50:14 +00:00
)
2024-04-17 15:32:23 +00:00
REDIS_URL = environ.get("REDIS_URL") or "redis://127.0.0.1"
2025-03-20 09:24:30 +00:00
# debug
2024-04-17 15:32:23 +00:00
GLITCHTIP_DSN = environ.get("GLITCHTIP_DSN")
2023-12-25 01:45:21 +00:00
2025-03-20 09:24:30 +00:00
# authorizer.dev
AUTH_URL = environ.get("AUTH_URL") or "https://auth.discours.io/graphql"
2024-04-17 15:32:23 +00:00
ADMIN_SECRET = environ.get("AUTH_SECRET") or "nothing"
2024-12-11 20:02:14 +00:00
WEBHOOK_SECRET = environ.get("WEBHOOK_SECRET") or "nothing-else"
2025-02-09 19:26:50 +00:00
# own auth
ONETIME_TOKEN_LIFE_SPAN = 60 * 60 * 24 * 3 # 3 days
SESSION_TOKEN_LIFE_SPAN = 60 * 60 * 24 * 30 # 30 days
JWT_ALGORITHM = "HS256"
2025-02-11 09:00:35 +00:00
JWT_SECRET_KEY = environ.get("JWT_SECRET") or "nothing-else-jwt-secret-matters"