-
Notifications
You must be signed in to change notification settings - Fork 2
Add fixes #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fixes #34
Changes from all commits
c795c13
1615a9e
5d9c389
7f6c720
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,15 +8,15 @@ cd "$SCRIPT_DIR" | |
| # Production-safe defaults (override with env vars). | ||
| HOST="${HOST:-0.0.0.0}" | ||
| PORT="${PORT:-8000}" | ||
| WORKERS="${WORKERS:-2}" | ||
| WORKERS="${WORKERS:-1}" | ||
|
|
||
| # Export DATABASE_URL (uses existing value if already set). | ||
| export DATABASE_URL="${DATABASE_URL:-sqlite:///./mpvrp_scoring.db}" | ||
| export FRONTEND_ALLOWED_ORIGINS="${FRONTEND_ALLOWED_ORIGINS:-https://ifri-ai-classes.github.io,https://ifri-ai-classes.github.io/MPVRP-CC,https://ifri-ai-classes.github.io/MPVRP-CC/pages}" | ||
| export FRONTEND_PROD_URL="${FRONTEND_PROD_URL:-https://ifri-ai-classes.github.io}" | ||
|
|
||
| # Require stable secret key in environments with external users. | ||
| # Generate and export a fresh SECRET_KEY at launch time. | ||
| export SECRET_KEY="$(python -c "import secrets; print(secrets.token_urlsafe(32))")" | ||
| export SECRET_KEY="X2ZlC8ezhVReYCer02s7TdwRT10epQMjwZVKAFwTOE4" | ||
| if [[ -z "${SECRET_KEY:-}" ]]; then | ||
| echo "ERROR: SECRET_KEY is required. Set it in your environment before starting the server." >&2 | ||
|
Comment on lines
17
to
21
|
||
| exit 1 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ALLOWED_ORIGINS currently always includes localhost origins and appends FRONTEND_PROD_URL even when it is an empty string. This broadens CORS in production and can also introduce an invalid origin entry. Consider rebuilding this list from environment configuration, filtering out falsy/invalid values, and only including localhost origins in dev/test.