Skip to content

Replace Hardcoded API URL Constant with Environment Variable #2493

@SakshiKekre

Description

@SakshiKekre

Currently, the API URL constant is hardcoded in the policyengine-app/src/api/call.js file. This limits flexibility when deploying across different environments (dev/production) and is prone to unintended bugs.

Proposal (Open for Discussion)
Opening this issue as a placeholder to come back to. There are a couple of possible directions we could take here:

Option 1: Use Environment Variables

  • Move API URL (and other) constants to .env files
  • Access them using process.env.* in the codebase
  • Caveat : Requires rebuild of the frontend app whenever env values change, which can slow down testing across multiple environments

Option 2: Centralized Config File

  • Create a single config file (e.g., src/config/env.js) where constants for different environments can be toggled manually or loaded based on a flag

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions