Environment Variables
You can provide environment variables to each side of your Redwood app in different ways, depending on each Side's target, and whether you're in development or production.
Right now, Redwood apps have two fixed Sides, API and Web, that each have a single target, nodejs and browser respectively.
Generally
Redwood apps use dotenv to load vars from your .env
file into process.env
.
For a reference on dotenv syntax, see the dotenv README's Rules section.
Technically, we use dotenv-defaults, which is how we also supply and load
.env.defaults
.
Redwood also configures Vite, so that all references to process.env
vars on the Web side will be replaced with the variable's actual value at build-time. More on this in Web.