Compare commits

...

3 Commits

Author SHA1 Message Date
Jonathan aedc6a8a17 Merge branch 'development' 2026-03-24 19:18:56 +01:00
Jonathan db9624822b Merge development: fix CORS for local dev on port 3001
Resolved conflict by keeping env var approach from main and updating
the default to include both localhost:3000 and localhost:3001.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 18:58:50 +01:00
Jonathan 470dd80ed8 Make CORS allowed origins configurable via ALLOWED_ORIGINS env var
Defaults to localhost:3000 for local dev. Server deployments can
pass a comma-separated list via the environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 18:15:44 +01:00
+5 -1
View File
@@ -1,3 +1,5 @@
import os
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
@@ -8,9 +10,11 @@ Base.metadata.create_all(bind=engine)
app = FastAPI(title="BTC Portfolio API")
origins = os.getenv("ALLOWED_ORIGINS", "http://localhost:3000,http://localhost:3001").split(",")
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000", "http://localhost:3001"],
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],