Skip to content
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

RFC: Environment variables #134

Open
QuiiBz opened this issue Aug 22, 2022 · 2 comments
Open

RFC: Environment variables #134

QuiiBz opened this issue Aug 22, 2022 · 2 comments
Milestone

Comments

@QuiiBz
Copy link
Member

QuiiBz commented Aug 22, 2022

Currently, environment variables are accessible with process.env, similar to Node.js. I came across an issue today with Lyra: to check if we are running in Node.js or an Edge runtime, they check if process !== undefined and then use an API that is available only on Node.js, but not on Lagon.

Using process.env to hold environment variables might be more challenging for external libraries to know in which environment they are running. Feel free to discuss your thoughts about this below.

For reference:

@QuiiBz QuiiBz added this to the Beta milestone Aug 22, 2022
@JoviDeCroock
Copy link

TIL about CloudFlare supporting the global environment variables 😅 honestly I agree with process being undefined in workers as they are closer to a browser environment. That being said my suggestion would be to support import.meta.emv which ties in with ESM and suggesting folks who want process.env to use something like the replace plugin from rollup

@QuiiBz
Copy link
Member Author

QuiiBz commented Jan 24, 2023

Great suggestion, I like it. Note that WinterCG might in the future define a unified way to access environment variables across all runtimes: wintercg/environment-metadata#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants