39 lines
954 B
Python
39 lines
954 B
Python
from functools import lru_cache
|
|
from pathlib import Path
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
ENV_PATH = Path(__file__).resolve().parents[2] / ".env"
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=str(ENV_PATH), env_file_encoding="utf-8", extra="ignore")
|
|
|
|
app_name: str = "nex_basse"
|
|
env: str = "dev"
|
|
api_v1_prefix: str = "/api/v1"
|
|
|
|
# Database
|
|
db_host: str = "127.0.0.1"
|
|
db_port: int = 3306
|
|
db_user: str = "root"
|
|
db_password: str = ""
|
|
db_name: str = "nex_basse"
|
|
db_echo: bool = False
|
|
|
|
# Redis
|
|
redis_host: str = "127.0.0.1"
|
|
redis_port: int = 6379
|
|
redis_db: int = 0
|
|
redis_password: str | None = None
|
|
|
|
# JWT
|
|
jwt_secret_key: str = "change_me"
|
|
jwt_algorithm: str = "HS256"
|
|
jwt_access_token_minutes: int = 60
|
|
jwt_refresh_token_minutes: int = 60 * 24 * 7
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|