-
Notifications
You must be signed in to change notification settings - Fork 3
/
base.py
46 lines (32 loc) · 900 Bytes
/
base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from __future__ import annotations
from pydantic import BaseSettings
class CelerySettings(BaseSettings):
RESULT_EXPIRES: int
RESULT_PERSISTENT: bool
WORKER_SEND_TASK_EVENT: bool
WORKER_PREFETCH_MULTIPLIER: int
class Config:
env_file = ".config.celery"
class DBSettings(BaseSettings):
DB_HOSTNAME: str
DB_PORT: str
DB_NAME: str
DB_USERNAME: str
DB_PASSWORD: str
class Config:
env_file = ".env"
class Settings(BaseSettings):
SECRET_KEY: str
REDIS_URL: str
SENTRY_DSN: str | None
SLACK_WEBHOOK_URL: str
ALLOWED_HOSTS: list = ["*"]
CACHE_MAX_AGE: int = 60
class Config:
env_file = ".env"
class CachedEndpoints(BaseSettings):
CACHED_ENDPOINTS: list = ["/cache-sample/"]
db_settings = DBSettings()
settings = Settings()
celery_settings = CelerySettings()
cached_endpoints = CachedEndpoints()