31 lines
852 B
Python
31 lines
852 B
Python
|
|
"""Application configuration loaded from environment variables.
|
||
|
|
|
||
|
|
All settings are read from environment variables prefixed with
|
||
|
|
``ARTIFACTSTORE_``. A ``.env`` file at the repository root is honoured for
|
||
|
|
local development; see ``.env.example``.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||
|
|
|
||
|
|
|
||
|
|
class Settings(BaseSettings):
|
||
|
|
"""Top-level service configuration."""
|
||
|
|
|
||
|
|
model_config = SettingsConfigDict(
|
||
|
|
env_prefix="ARTIFACTSTORE_",
|
||
|
|
env_file=".env",
|
||
|
|
env_file_encoding="utf-8",
|
||
|
|
extra="ignore",
|
||
|
|
)
|
||
|
|
|
||
|
|
database_url: str = "sqlite+aiosqlite:///./var/artifactstore.db"
|
||
|
|
storage_local_root: str = "./var/storage"
|
||
|
|
log_level: str = "INFO"
|
||
|
|
|
||
|
|
|
||
|
|
def get_settings() -> Settings:
|
||
|
|
"""Return a freshly-loaded :class:`Settings` instance."""
|
||
|
|
return Settings()
|