Skip to content

Commit 3875130

Browse files
committed
Configure for Railway deployment
1 parent 3df83a5 commit 3875130

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: gunicorn application:app --bind 0.0.0.0:5000 -k uvicorn.workers.UvicornWorker
1+
web: gunicorn application:app -k uvicorn.workers.UvicornWorker -b 0.0.0.0:$PORT

application.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
from fastapi import FastAPI
22
from fastapi.middleware.cors import CORSMiddleware
33
from backend.app.main import app
4+
import os
45

56
# Create FastAPI application
67
application = FastAPI()
78

89
# Add CORS middleware
910
application.add_middleware(
1011
CORSMiddleware,
11-
allow_origins=["*"],
12+
allow_origins=os.getenv("ALLOWED_ORIGINS", "*").split(","),
1213
allow_credentials=True,
1314
allow_methods=["*"],
1415
allow_headers=["*"]
@@ -27,4 +28,5 @@ def health_check():
2728

2829
if __name__ == "__main__":
2930
import uvicorn
30-
uvicorn.run("application:app", host="0.0.0.0", port=5000)
31+
port = int(os.getenv("PORT", 8000))
32+
uvicorn.run("application:app", host="0.0.0.0", port=port)

0 commit comments

Comments
 (0)