Skip to content

Api url 2493#2510

Open
fudgemasterultra wants to merge 2 commits into
PolicyEngine:mainfrom
fudgemasterultra:api-url-2493
Open

Api url 2493#2510
fudgemasterultra wants to merge 2 commits into
PolicyEngine:mainfrom
fudgemasterultra:api-url-2493

Conversation

@fudgemasterultra
Copy link
Copy Markdown

Environment Configuration and API Setup

What Changed

  • Created .env.example file as a template for environment configuration
  • Added .env to .gitignore to prevent committing configuration
  • Added a Makefile command to automatically copy .env.example to .env
  • Modified the apiCall function to use environment variables with a fallback URL

Why This Change

  • Improves developer onboarding by providing a clear template for environment setup
  • Simplifies local development setup with an automated environment configuration command
  • Provides resilience with a fallback API URL when environment variables aren't set
  • Makes the application more maintainable across different environments

Technical Details

  • Added cp .env.example .env command to Makefile for easy environment setup
  • API endpoint configuration now follows: process.env.REACT_APP_POLICYENGINE_API || "https://api.policyengine.org"
  • .env file is ignored in version control

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 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 Apr 28, 2025 8:54pm

Comment thread src/api/call.js
headers: {
"Content-Type": "application/json",
return fetchMethod(
process.env.REACT_APP_POLICYENGINE_API ||
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question: Would it be more advantageous to set the POLICYENGINE_API constant as either the env var or standard address, then use that constant in the fetch method?

This would enable other components, as needed, to import the constant

Copy link
Copy Markdown
Collaborator

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this @fudgemasterultra. Apologies for the delay in review, I was unavailable last week for work-related reasons.

I left one comment. Would you mind following our README guide to creating a PR (including adding a "Fixes #ISSUE" line) and addressing my one comment? Otherwise, this will be really valuable to have.

@anth-volk
Copy link
Copy Markdown
Collaborator

@sreeshanth-soma You are not a repo or org maintainer. Do not provide review unless a repo or org explicitly says they welcome reviews from read-only reviewers. Review is traditionally done by maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: PR: Review Requested

Development

Successfully merging this pull request may close these issues.

3 participants