feat: add pydantic-settings configuration module
This commit is contained in:
parent
31fe60f756
commit
1aae932d1e
29
src/proxy_pool/config.py
Normal file
29
src/proxy_pool/config.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
from functools import lru_cache
|
||||||
|
|
||||||
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||||
|
|
||||||
|
|
||||||
|
class Settings(BaseSettings):
|
||||||
|
model_config = SettingsConfigDict(
|
||||||
|
env_file=".env",
|
||||||
|
env_file_encoding="utf-8",
|
||||||
|
case_sensitive=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Infrastructure
|
||||||
|
database_url: str
|
||||||
|
redis_url: str
|
||||||
|
secret_key: str
|
||||||
|
|
||||||
|
# Application
|
||||||
|
app_name: str = "proxy-pool"
|
||||||
|
log_level: str = "INFO"
|
||||||
|
|
||||||
|
# Database pool
|
||||||
|
db_pool_size: int = 10
|
||||||
|
db_max_overflow: int = 10
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
|
def get_settings() -> Settings:
|
||||||
|
return Settings()
|
||||||
Loading…
x
Reference in New Issue
Block a user