Skip to content

Implementation for replacement of hardcoded API URLs with config-base…#2517

Closed
SongmingFan123 wants to merge 1 commit into
masterfrom
issue-2492-replace-hardcoded-API-URLs-with-config-based-approach
Closed

Implementation for replacement of hardcoded API URLs with config-base…#2517
SongmingFan123 wants to merge 1 commit into
masterfrom
issue-2492-replace-hardcoded-API-URLs-with-config-based-approach

Conversation

@SongmingFan123
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings May 3, 2025 02:02
@vercel
Copy link
Copy Markdown

vercel Bot commented May 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
policyengine-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 3, 2025 2:04am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR shifts hardcoded API URL values to centralized configuration, improving maintainability and flexibility.

  • Replaced literal API URLs in authentication and API call logic with config constants.
  • Removed duplicate authentication constants from authUtils while updating Auth0 provider configuration.
  • Updated README.md to document environment variable usage.

Reviewed Changes

Copilot reviewed 7 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/hooks/useAuthenticatedFetch.js Replaced hardcoded audience URL with a config constant.
src/config/index.js Introduced config constants for API URLs and Auth settings.
src/auth/authUtils.js Removed duplicate Auth0 configuration values.
src/auth/Auth0ProviderWithNavigate.jsx Updated to use centralized config for Auth0 parameters.
src/api/call.js Replaced hardcoded API URL with the API_URL config constant.
README.md Added documentation for environment configuration.
Files not reviewed (4)
  • .env.development: Language not supported
  • .env.example: Language not supported
  • .env.production: Language not supported
  • package.json: Language not supported

Comment thread src/api/call.js
fetchMethod = fetch,
) {
return fetchMethod(POLICYENGINE_API + path, {
return fetchMethod(API_URL + path, {
Copy link

Copilot AI May 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider ensuring consistent slash usage when concatenating API_URL with path, as the API_URL and API_AUDIENCE values use different trailing slash conventions. A utility function or normalization could prevent potential URL concatenation issues.

Copilot uses AI. Check for mistakes.
@anth-volk
Copy link
Copy Markdown
Collaborator

Closing in favor of #2510.

@anth-volk anth-volk closed this May 6, 2025
@github-project-automation github-project-automation Bot moved this from Todo to Closed in policyengine-app May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

4 participants