63 lines
1.9 KiB
Python
63 lines
1.9 KiB
Python
from __future__ import annotations
|
|
|
|
from functools import lru_cache
|
|
from typing import Literal
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
#env_prefix="ACUPEDIA_",
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
case_sensitive=False,
|
|
extra="ignore",
|
|
)
|
|
|
|
app_name: str = "AcuPedia"
|
|
app_version: str = "0.1.0"
|
|
app_env: Literal["local", "dev", "test", "stage", "prod"] = "local"
|
|
debug: bool = False
|
|
content_preview_enabled: bool = False
|
|
api_prefix: str = "/api/v1"
|
|
cors_origins: str = "http://localhost:3000,http://localhost:8000"
|
|
|
|
database_url: str = "postgresql+asyncpg://postgres:C1234spl@localhost:5432/panaceadb"
|
|
database_echo: bool = False
|
|
database_pool_size: int = 10
|
|
database_max_overflow: int = 20
|
|
database_pool_timeout_seconds: int = 30
|
|
|
|
redis_url: str = "redis://localhost:6379/0"
|
|
|
|
s3_endpoint_url: str | None = "http://localhost:9000"
|
|
s3_access_key_id: str = "minioadmin"
|
|
s3_secret_access_key: str = "minioadmin"
|
|
s3_bucket: str = "panacea-assets"
|
|
s3_region: str = "ap-south-1"
|
|
s3_force_path_style: bool = True
|
|
s3_secure: bool = True
|
|
s3_presign_expiry_seconds: int = 900
|
|
|
|
auth_dev_fallback: bool = False
|
|
auth_dev_subject_id: str = "00000000-0000-0000-0000-000000000001"
|
|
auth_dev_email: str = "dev-admin@cniwas.local"
|
|
auth_dev_display_name: str = "Development Admin"
|
|
|
|
audit_hash_secret: str = "replace-this-in-production"
|
|
audit_actor_display_name_claim: str = "name"
|
|
default_actor: str = "system"
|
|
|
|
|
|
@property
|
|
def cors_origin_list(self) -> list[str]:
|
|
return [item.strip() for item in self.cors_origins.split(",") if item.strip()]
|
|
|
|
|
|
|
|
@lru_cache(maxsize=1)
|
|
def get_settings() -> Settings:
|
|
return Settings()
|
|
|
|
settings = get_settings() |