first
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from pathlib import Path
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/status")
|
||||
def bootstrap_status():
|
||||
privix_path = Path("/privix")
|
||||
|
||||
if not privix_path.exists():
|
||||
return {
|
||||
"mode": "bootstrap",
|
||||
"source_attached": False,
|
||||
"privix_path": None,
|
||||
"message": "/privix does not exist. Choose create, attach, mount, or restore.",
|
||||
}
|
||||
|
||||
return {
|
||||
"mode": "bootstrap",
|
||||
"source_attached": False,
|
||||
"privix_path": str(privix_path),
|
||||
"privix_exists": True,
|
||||
"message": "/privix exists, but is not attached yet.",
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
from app.api.v1.routes import bootstrap
|
||||
|
||||
app = FastAPI(
|
||||
title="PRIVIX API",
|
||||
version="0.1.0",
|
||||
description="Local PRIVIX control API",
|
||||
)
|
||||
|
||||
app.include_router(
|
||||
bootstrap.router,
|
||||
prefix="/api/v1/bootstrap",
|
||||
tags=["bootstrap"],
|
||||
)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def root():
|
||||
return {
|
||||
"name": "PRIVIX API",
|
||||
"status": "running",
|
||||
"api": "/api/v1",
|
||||
"docs": "/docs",
|
||||
}
|
||||
Reference in New Issue
Block a user