feat(web): add FastAPI backend with scan, plot, and benchmark endpoints
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""Startup script for the web server."""
|
||||
|
||||
import argparse
|
||||
import uvicorn
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point for the web server."""
|
||||
parser = argparse.ArgumentParser(description="Start Disk Checker API server")
|
||||
parser.add_argument("--host", default="127.0.0.1", help="Host to bind to")
|
||||
parser.add_argument("--port", type=int, default=8000, help="Port to bind to")
|
||||
parser.add_argument("--workers", type=int, default=1, help="Number of workers")
|
||||
parser.add_argument("--reload", action="store_true", help="Enable auto-reload")
|
||||
parser.add_argument("--work-dir", type=Path, default=Path("."), help="Work directory")
|
||||
args = parser.parse_args()
|
||||
|
||||
# Set work directory in environment
|
||||
import os
|
||||
os.environ["DISK_CHECKER_WORK_DIR"] = str(args.work_dir)
|
||||
|
||||
uvicorn.run(
|
||||
"disk_checker.web.server:app",
|
||||
host=args.host,
|
||||
port=args.port,
|
||||
workers=args.workers,
|
||||
reload=args.reload,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user