shelfgot commited on
Commit
08a55bd
·
verified ·
1 Parent(s): e6e733d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -23,10 +23,14 @@ logger = logging.getLogger(__name__)
23
 
24
  app = FastAPI(title="Talmud Language Classifier Training")
25
 
 
 
 
26
  # Enable CORS for Vercel callbacks
27
  app.add_middleware(
28
  CORSMiddleware,
29
- allow_origins=["*"], # In production, restrict to your Vercel domain
 
30
  allow_credentials=True,
31
  allow_methods=["*"],
32
  allow_headers=["*"],
 
23
 
24
  app = FastAPI(title="Talmud Language Classifier Training")
25
 
26
+ VERCEL_PRODUCTION_URL = os.getenv('VERCEL_PRODUCTION_URL', 'https://talmud-annotation-platform.vercel.app')
27
+ VERCEL_PREVIEW_URL_REGEX = r'https://talmud-annotation-platform-[a-zA-Z0-9]{9}-shmans-projects\.vercel\.app'
28
+
29
  # Enable CORS for Vercel callbacks
30
  app.add_middleware(
31
  CORSMiddleware,
32
+ allow_origins=[VERCEL_PRODUCTION_URL],
33
+ allow_origin_regex=VERCEL_PREVIEW_URL_REGEX,
34
  allow_credentials=True,
35
  allow_methods=["*"],
36
  allow_headers=["*"],