Spaces:
Running
Running
File size: 578 Bytes
b7bd3ec |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from functools import lru_cache
from pydantic_settings import BaseSettings, SettingsConfigDict
from pydantic import Field
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
class Settings(BaseSettings):
"""Global configuration loaded from environment variables."""
redis_url: str = Field("redis://localhost:6379")
api_key: str = Field("123456")
model_config = SettingsConfigDict(
env_file = BASE_DIR / ".env",
env_file_encoding = "utf-8",
)
@lru_cache
def get_settings() -> Settings:
return Settings()
|