foxnouns/foxnouns/settings.py
2024-03-13 17:03:18 +01:00

37 lines
926 B
Python

from environs import Env
from sqlalchemy import URL
# read .env file
env = Env()
env.read_env()
DATABASE = {
"USER": env("DATABASE_USER"),
"PASSWORD": env("DATABASE_PASSWORD"),
"HOST": env("DATABASE_HOST"),
"NAME": env("DATABASE_NAME"),
}
SYNC_DATABASE_URL = URL.create(
"postgresql+psycopg",
username=DATABASE["USER"],
password=DATABASE["PASSWORD"],
host=DATABASE["HOST"],
database=DATABASE["NAME"],
)
ASYNC_DATABASE_URL = URL.create(
"postgresql+asyncpg",
username=DATABASE["USER"],
password=DATABASE["PASSWORD"],
host=DATABASE["HOST"],
database=DATABASE["NAME"],
)
# The base domain the API is served on. This must be set.
BASE_DOMAIN = env("BASE_DOMAIN")
# The base domain for short URLs.
SHORT_DOMAIN = env("SHORT_DOMAIN", "prns.localhost")
# Secret key for signing tokens, generate with (for example) `openssl rand -base64 32`
SECRET_KEY = env("SECRET_KEY")