feat: bootstrap FastAPI configuration
This commit is contained in:
22
app/main.py
Normal file
22
app/main.py
Normal file
@@ -0,0 +1,22 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user