chore: update redirect url setting - #12
Conversation
chore: update redirect url setting
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2fec398e48
ℹ️ 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".
| ssl: { | ||
| rejectUnauthorized: false, | ||
| }, |
There was a problem hiding this comment.
Avoid forcing SSL for all drizzle-kit connections
This config now enables SSL unconditionally. The local development Postgres in compose.yaml uses the stock postgres:latest image without SSL certs configured, which rejects SSL connections by default. As a result, drizzle-kit generate/migrate/studio will fail locally with a “server does not support SSL” error when using the standard DATABASE_URL. Consider gating ssl on an environment flag or encoding sslmode in DATABASE_URL so local dev remains usable.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR adds support for a configurable redirect URL (VITE_REDIRECT_URL) throughout the application stack, replacing a previously hardcoded callback URL for Discord OAuth authentication. Additionally, it enables SSL configuration for database connections and adds a production frontend URL to the backend's trusted origins.
Key changes:
- Added VITE_REDIRECT_URL environment variable across setup scripts, frontend code, and CI/CD workflows
- Replaced hardcoded callback URL 'http://localhost:5173/' with configurable environment variable
- Enabled SSL configuration in Drizzle database config with certificate validation disabled
- Added production URL 'https://pay-crew2.yukiosada.work' to backend trusted origins
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| setup/src/types.ts | Added viteRedirectUrl field to FrontendConfig type definition |
| setup/src/functions.ts | Added loading and configuration of VITE_REDIRECT_URL environment variable |
| setup/src/index.ts | Added VITE_REDIRECT_URL to generated frontend .env file |
| products/frontend/src/routes/Root/index.tsx | Fixed import path typo and replaced hardcoded callback URL with environment variable |
| products/frontend/.env.example | Added VITE_REDIRECT_URL to example environment file |
| products/backend/src/auth.ts | Added production URL to trustedOrigins array |
| products/backend/src/auth.cli.ts | Added production URL to trustedOrigins array |
| products/backend/drizzle.config.ts | Enabled SSL configuration with rejectUnauthorized set to false |
| .github/workflows/preview-frontend.yaml | Added VITE_REDIRECT_URL secret to build environment |
| .github/workflows/deploy-frontend.yaml | Added VITE_REDIRECT_URL secret to build environment |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| baseURL: env.BETTER_AUTH_URL, | ||
| // allow requests from the frontend development server | ||
| trustedOrigins: ['http://localhost:5173'], | ||
| trustedOrigins: ['https://pay-crew2.yukiosada.work', 'http://localhost:5173'], |
There was a problem hiding this comment.
Hardcoding the production URL 'https://pay-crew2.yukiosada.work' in trustedOrigins reduces maintainability and makes the code less flexible across different environments (staging, preview, production). Consider extracting this to an environment variable or deriving it from the existing BETTER_AUTH_URL to make the configuration more maintainable and environment-agnostic.
| baseURL: process.env.BETTER_AUTH_URL as string, | ||
| // allow requests from the frontend development server | ||
| trustedOrigins: ['http://localhost:5173'], | ||
| trustedOrigins: ['https://pay-crew2.yukiosada.work', 'http://localhost:5173'], |
There was a problem hiding this comment.
Hardcoding the production URL 'https://pay-crew2.yukiosada.work' in trustedOrigins reduces maintainability and makes the code less flexible across different environments (staging, preview, production). Consider extracting this to an environment variable or deriving it from the existing BETTER_AUTH_URL to make the configuration more maintainable and environment-agnostic.
| ssl: { | ||
| rejectUnauthorized: false, | ||
| }, |
There was a problem hiding this comment.
Setting rejectUnauthorized: false disables SSL certificate validation, which creates a security vulnerability by allowing man-in-the-middle attacks. While this might be necessary for development or certain database providers, it should be avoided in production. Consider making this configurable via an environment variable so it can be set to true in production while allowing false for development environments where self-signed certificates might be used.
No description provided.