hack4impact-calpoly / general-vms

General volunteer management system.
2 stars 0 forks source link

[Frontend] Setup environment variables for staging (dev vs prod) -- Investigation and Implementation #36

Open bglossner opened 2 years ago

bglossner commented 2 years ago

We are going to want to switch out certain things in our app based on the environment.

The easy example, and one we should implement, is the changing backend URL that we will want to hit (for dev, this should be localhost:<port defined in environment variable> and for the prod URL it should be just some garbage for now (just make something up, it won't be used for awhile).

Check out https://create-react-app.dev/docs/adding-custom-environment-variables/ and search "react app environments".

NOTE: We do want this to be "correct" in a sense so it's worth spending the time investigating for the best solution. Please write down any findings on things that do work and don't work and pros/cons of different approaches and why we want to use the way you have suggested. It's fine if this write up is short... because React recommends it officially is totally ok for a reason.