Files
pdf/gateway/app/config.py
T

34 lines
956 B
Python

"""Runtime configuration loaded from environment variables.
Anything that varies between dev / staging / prod (storage URLs, queue
endpoints, auth secrets) lands here. Phase 0 only exposes the bare minimum
needed for `/health` and the app factory.
"""
from functools import lru_cache
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_prefix="PDFENGINE_",
env_file=".env",
extra="ignore",
)
environment: str = Field(default="dev", description="dev | staging | prod")
engine_available: bool = Field(
default=False,
description=(
"True once the pybind11 module in bindings/python/ is importable. "
"Phase 0 default is False — routes that need the engine return 501."
),
)
@lru_cache(maxsize=1)
def get_settings() -> Settings:
return Settings()