Files
truenas-stacks/home/minerva-dashboard/app/main.py
Fizzlepoof 2db6a23a2c
Some checks failed
secret-guardrails / artifact-secret-scan (push) Has been cancelled
secret-guardrails / gitleaks (push) Has been cancelled
home: add minerva dashboard scaffold
2026-05-25 15:40:26 +00:00

28 lines
820 B
Python

from __future__ import annotations
from pathlib import Path
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from app.config import Settings
from app.routes.api import router as api_router
from app.routes.ui import router as ui_router
from app.services.store import JSONStore
BASE_DIR = Path(__file__).resolve().parent
def create_app(state_dir: Path | str | None = None) -> FastAPI:
settings = Settings()
app = FastAPI(title=settings.app_name)
resolved_state_dir = Path(state_dir) if state_dir is not None else settings.default_state_dir
app.state.store = JSONStore(resolved_state_dir)
app.mount('/static', StaticFiles(directory=BASE_DIR / 'static'), name='static')
app.include_router(ui_router)
app.include_router(api_router)
return app
app = create_app()