Files
labFusion/services/service-adapters/main.py
GSRN 8306137ef3
Some checks failed
Integration Tests / integration-tests (push) Failing after 27s
Integration Tests / performance-tests (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 39s
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 40s
Service Adapters (Python FastAPI) / test (3.14) (push) Failing after 11s
Service Adapters (Python FastAPI) / test (3.13) (push) Failing after 41s
Service Adapters (Python FastAPI) / build (push) Has been skipped
Docker Build and Push / build-and-push (push) Failing after 3m1s
chore: Update host binding in service-adapters main.py
### Summary of Changes
- Changed the host binding in `main.py` from `0.0.0.0` to `127.0.0.1` to restrict access to localhost, enhancing security by preventing external access.

### Expected Results
- Improved security posture of the service-adapters module by limiting the network exposure of the application.
2025-09-16 23:55:41 +02:00

39 lines
1.1 KiB
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
# Import route modules
from routes import events, frigate, general, home_assistant, immich
# Create FastAPI app
app = FastAPI(
title="LabFusion Service Adapters",
description="Service integration adapters for Home Assistant, Frigate, Immich, and other homelab services",
version="1.0.0",
license_info={"name": "MIT License", "url": "https://opensource.org/licenses/MIT"},
servers=[
{"url": "http://localhost:8000", "description": "Development Server"},
{"url": "https://adapters.labfusion.dev", "description": "Production Server"},
],
)
# CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include routers
app.include_router(general.router)
app.include_router(home_assistant.router)
app.include_router(frigate.router)
app.include_router(immich.router)
app.include_router(events.router)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="127.0.0.1", port=8000)