feat: update environment configuration for Docker and frontend compon… - #2
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0603c4646d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import { useNavigate, Link } from "react-router-dom"; | ||
|
|
||
| const API_URL = import.meta.env.VITE_API_URL || "http://127.0.0.1:8000"; | ||
| const API_URL = import.meta.env.VITE_API_URL || window.location.origin; |
There was a problem hiding this comment.
Restore the standalone Vite API fallback
When following the documented npm run dev flow without setting VITE_API_URL, this now resolves API calls to the Vite origin (http://localhost:5173). frontend/vite.config.js has no /api proxy, while Django runs on port 8000, so login and the other clients changed to this fallback receive the frontend server's SPA response instead of reaching the API.
Useful? React with 👍 / 👎.
| dockerfile: deployments/Dockerfile.frontend | ||
| args: | ||
| VITE_API_URL: ${VITE_API_URL:-http://localhost:8000} | ||
| VITE_API_URL: ${VITE_API_URL:-http://localhost} |
There was a problem hiding this comment.
Route the Docker frontend API base through its published port
In the default development Compose stack, the frontend is published only on host port 5173, and its nginx /api/ proxy is therefore reached at http://localhost:5173. Baking http://localhost into the bundle instead makes every browser API request go to port 80, where this stack publishes nothing; the default dashboard, registration, and payment flows cannot reach the backend unless users add a manual override.
Useful? React with 👍 / 👎.
| PAYSTACK_SECRET_KEY: ${PAYSTACK_SECRET_KEY:-} | ||
| PAYSTACK_PUBLIC_KEY: ${PAYSTACK_PUBLIC_KEY:-} | ||
| FRONTEND_URL: ${FRONTEND_URL:-http://localhost:5173} | ||
| FRONTEND_URL: ${FRONTEND_URL:-http://localhost} |
There was a problem hiding this comment.
Keep generated frontend links on the development frontend port
With the default development Compose mapping, the frontend is available at http://localhost:5173, not port 80. The backend uses FRONTEND_URL to generate QR /pay links and verification-email links, so this default sends scanned-payment and emailed-verification users to http://localhost/..., where no frontend service is exposed.
Useful? React with 👍 / 👎.
| amount, | ||
| vendor, | ||
| output_dir="qr_codes", | ||
| backend_url="http://localhost", |
There was a problem hiding this comment.
Retain the backend port for the QR generator default
Running this script with its documented arguments after starting Django via python manage.py runserver now posts to port 80 instead of Django's default port 8000. The CLI exposes no backend URL argument, so its normal pre-registration step always fails unless an unrelated service happens to proxy the API on port 80.
Useful? React with 👍 / 👎.
…ents