All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 41s
Add the PostgreSQL backend, migration and stopped-write transfer tools, lease-aware deployment manifests, tenancy declarations, and shared conformance coverage. Persist grouping mutations in durable stores and separate process liveness from database readiness.
32 lines
1 KiB
Python
32 lines
1 KiB
Python
from __future__ import annotations
|
|
|
|
import uvicorn
|
|
|
|
from tenant_engine.app import create_app
|
|
from tenant_engine.config import Settings
|
|
from tenant_engine.postgres_store import PostgresTenantStore
|
|
from tenant_engine.sqlite_store import SQLiteTenantStore
|
|
from tenant_engine.store import TenantStore
|
|
|
|
|
|
def main() -> None:
|
|
settings = Settings.from_env()
|
|
store = _build_store(settings)
|
|
uvicorn.run(create_app(settings=settings, store=store), host=settings.host, port=settings.port)
|
|
|
|
|
|
def _build_store(settings: Settings) -> TenantStore | None:
|
|
if settings.database_path and settings.database_url_file:
|
|
raise RuntimeError(
|
|
"refusing ambiguous store configuration: set only one of "
|
|
"TENANT_ENGINE_DATABASE_PATH or TENANT_ENGINE_DATABASE_URL_FILE"
|
|
)
|
|
if settings.database_url_file:
|
|
return PostgresTenantStore(settings.database_url_file)
|
|
if settings.database_path:
|
|
return SQLiteTenantStore(settings.database_path)
|
|
return None
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|