-
Notifications
You must be signed in to change notification settings - Fork 61
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
chore(consultation-portal): Move to ts, and use API_URL
#17133
Conversation
WalkthroughThe changes in this pull request involve updates to the environment variable configuration for local development, the introduction of a new proxy configuration file, and a modification of the import statement for the proxy configuration in the server file. Specifically, the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant Proxy
Client->>Server: Request to /api/graphql
Server->>Proxy: Forward request to /api/graphql
Proxy->>Proxy: Check API_URL
alt API_URL is set
Proxy->>Proxy: Use API_URL as target
else API_URL is not set
Proxy->>Proxy: Default to http://localhost:4444
end
Proxy->>Target: Forward request to target server
Target-->>Proxy: Response
Proxy-->>Server: Forward response
Server-->>Client: Send response
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
apps/consultation-portal/proxy.config.ts (1)
3-3
: Add URL validation for API_URL environment variableThe API_URL is used without validation, which could lead to runtime issues if an invalid URL is provided.
+const validateUrl = (url: string): string => { + try { + new URL(url); + return url; + } catch { + return 'http://localhost:4444'; + } +}; + const proxyConfig: ProxyConfig = { '/api/graphql': { - target: process.env.API_URL ?? 'http://localhost:4444', + target: validateUrl(process.env.API_URL ?? 'http://localhost:4444'), secure: false, }, }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (4)
apps/consultation-portal/infra/samradsgatt.ts
(1 hunks)apps/consultation-portal/proxy.config.json
(0 hunks)apps/consultation-portal/proxy.config.ts
(1 hunks)apps/consultation-portal/server.ts
(1 hunks)
💤 Files with no reviewable changes (1)
- apps/consultation-portal/proxy.config.json
🧰 Additional context used
📓 Path-based instructions (3)
apps/consultation-portal/proxy.config.ts (1)
Pattern apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
apps/consultation-portal/server.ts (1)
Pattern apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
apps/consultation-portal/infra/samradsgatt.ts (1)
Pattern apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (2)
apps/consultation-portal/server.ts (1)
2-2
: LGTM! Import statement follows TypeScript best practices
The import statement correctly omits the file extension, allowing TypeScript's module resolution to work properly.
apps/consultation-portal/infra/samradsgatt.ts (1)
31-31
: LGTM! Local environment configuration follows established pattern
The added local environment URL maintains consistency with other environment configurations and follows the same path structure.
✅ Verification successful
URL pattern consistency verified across environments
The verification confirms that the local environment URL follows the same /samradsgatt/api/auth
pattern consistently used across all environments (dev, staging, prod) and in the logout functionality.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify URL pattern consistency across the codebase
rg -g '*.ts' -g '*.js' '/samradsgatt/api/auth' --no-filename | sort -u
Length of output: 407
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.
LGTM 🚀
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.
LGTM
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17133 +/- ##
=======================================
Coverage 35.74% 35.74%
=======================================
Files 6925 6925
Lines 147558 147558
Branches 42009 42009
=======================================
Hits 52745 52745
Misses 94813 94813
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
Datadog ReportBranch report: ✅ 0 Failed, 84 Passed, 0 Skipped, 33.66s Total Time |
Summary by CodeRabbit
New Features
Bug Fixes
Refactor