saadrizvi09 commited on
Commit
29e6847
·
1 Parent(s): b1f38ad

Enable CORS for Vercel and use environment variables

Browse files
Files changed (1) hide show
  1. main.py +4 -2
main.py CHANGED
@@ -40,7 +40,8 @@ async def lifespan(app: FastAPI):
40
  app = FastAPI(lifespan=lifespan)
41
 
42
  # --- CONFIGURATION ---
43
- SECRET_KEY = "algoquant_super_secret_key" # Use os.getenv("SECRET_KEY")
 
44
  ALGORITHM = "HS256"
45
  ACCESS_TOKEN_EXPIRE_MINUTES = 43200 # 30 days (30 * 24 * 60)
46
  pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
@@ -50,7 +51,8 @@ app.add_middleware(
50
  CORSMiddleware,
51
  allow_origins=[
52
  "http://localhost:3000",
53
- "http://127.0.0.1:3000"
 
54
  ],
55
  allow_credentials=True,
56
  allow_methods=["*"],
 
40
  app = FastAPI(lifespan=lifespan)
41
 
42
  # --- CONFIGURATION ---
43
+ import os
44
+ SECRET_KEY = os.getenv("SECRET_KEY", "algoquant_super_secret_key")
45
  ALGORITHM = "HS256"
46
  ACCESS_TOKEN_EXPIRE_MINUTES = 43200 # 30 days (30 * 24 * 60)
47
  pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
 
51
  CORSMiddleware,
52
  allow_origins=[
53
  "http://localhost:3000",
54
+ "http://127.0.0.1:3000",
55
+ "https://algo-quant-pi.vercel.app"
56
  ],
57
  allow_credentials=True,
58
  allow_methods=["*"],