23 lines
574 B
Python
23 lines
574 B
Python
from fastapi import FastAPI
|
|
|
|
from app.config import Settings, get_settings
|
|
|
|
|
|
def create_app(settings: Settings | None = None) -> FastAPI:
|
|
resolved = settings or get_settings()
|
|
resolved.data_dir.mkdir(parents=True, exist_ok=True)
|
|
resolved.tokens_dir.mkdir(parents=True, exist_ok=True)
|
|
resolved.activities_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
app = FastAPI(title="MyWhoosh Garmin Sync")
|
|
app.state.settings = resolved
|
|
|
|
@app.get("/healthz")
|
|
def healthz() -> dict[str, str]:
|
|
return {"status": "ok"}
|
|
|
|
return app
|
|
|
|
|
|
app = create_app()
|