69a232d08a
- FastAPI: POST /api/v1/events, GET /health, JSON Schema validation - PostgreSQL models, Alembic migration, bootstrap API key - deploy/docker-compose.yml, .env.example - docs/install-ubuntu-24.04.md, updated work-plan (agents first)
34 lines
908 B
Python
34 lines
908 B
Python
from functools import lru_cache
|
|
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
SCHEMA_PATH = ROOT / "schemas" / "event-schema-v1.json"
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
extra="ignore",
|
|
)
|
|
|
|
database_url: str = "postgresql+psycopg2://sac:sac@localhost:5432/sac"
|
|
sac_public_url: str = "http://localhost:8000"
|
|
jwt_secret: str = "change-me-in-production"
|
|
jwt_algorithm: str = "HS256"
|
|
jwt_expire_minutes: int = 60 * 24
|
|
|
|
sac_bootstrap_api_key: str = ""
|
|
sac_admin_username: str = "admin"
|
|
sac_admin_password: str = ""
|
|
|
|
event_schema_path: str = str(SCHEMA_PATH) # override: EVENT_SCHEMA_PATH
|
|
cors_origins: str = "*"
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|