-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (27 loc) · 1.1 KB
/
Copy pathmain.py
File metadata and controls
32 lines (27 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.routes import router
from app.adapters.config.settings import settings
app = FastAPI(title="PC Agent Control API", version="0.6.0")
app.add_middleware(
CORSMiddleware,
allow_origins=settings.cors_origins,
allow_credentials=False,
allow_methods=["*"],
allow_headers=["*"],
)
@app.on_event("startup")
async def startup_event():
from app.adapters.config.runtime_config import RuntimeConfigStore
from app.adapters.config.settings import settings
store = RuntimeConfigStore()
s_url = settings.effective("supabase_url")
s_key = settings.effective("supabase_service_role_key")
if s_url and s_key:
print(f"[STARTUP] Intentando cargar configuración desde Supabase: {s_url}")
success = await store.load_from_supabase(s_url, s_key)
if success:
print("[STARTUP] Configuración cargada exitosamente desde Supabase.")
else:
print("[STARTUP] No se encontró configuración previa en Supabase o hubo un error.")
app.include_router(router)