Skip to content

Api url 2493 #2510

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fudgemasterultra
Copy link

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

Copy link

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

headers: {
"Content-Type": "application/json",
return fetchMethod(
process.env.REACT_APP_POLICYENGINE_API ||
Copy link
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
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.

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.

2 participants