Replies: 2 comments
-
This needs to configure the env variables you want to make public and available client-side, and to return them from a loader (probably root) and save them in an inlined script. I'm not sure how an util could help with that, the amount of code will not change that much anyway, do you have some idea on how the API of the util could look like? |
Beta Was this translation helpful? Give feedback.
-
Hi @sergiodxa thanks for getting back to me. Not a design no. I had been thinking that you feed in a list of KEYS that you want available, and then a helper function helps retrieve them and make them available. With optional flags such as 'fail if not found' etc. |
Beta Was this translation helpful? Give feedback.
-
Creation of a Util function to retrieve process.env variables in a client only scenario such as the client entry point
Ref: https://egghead.io/lessons/remix-expose-specific-environmental-variables-to-the-client-using-remix
Code: https://github.com/kentcdodds/onewheel-blog/blob/main/app/env.server.ts
Beta Was this translation helpful? Give feedback.
All reactions