-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
31 lines (24 loc) · 843 Bytes
/
config.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
#the file for importing of the config settings which will be used for the database connection
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
DB_USER: str
DB_PASS: str
DB_HOST: str
DB_NAME: str
DB_PORT: int
MODE: str
CACHE_REDIS_HOST: str
CACHE_REDIS_PORT: int
CACHE_REDIS_DB: int
CACHE_TYPE: str
CACHE_DEFAULT_TIMEOUT: int #ttl for cache
CACHE_KEY_PREFIX: str
CACHE_CHECK_TIMEOUT: int #how frequently check the ttl of the cache
NUMBER_OF_TESTS: int
SERVER_HOST: str
SERVER_PORT: int
@property
def DB_URL(self):
return f"mysql+pymysql://{self.DB_USER}:{self.DB_PASS}@{self.DB_HOST}:{self.DB_PORT}/{self.DB_NAME}"
model_config = SettingsConfigDict(env_file=".env", extra='allow')
settings = Settings()