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

Accessing Variables dynamically #139

Closed
BrandonMurnane opened this issue Aug 15, 2018 · 3 comments
Closed

Accessing Variables dynamically #139

BrandonMurnane opened this issue Aug 15, 2018 · 3 comments

Comments

@BrandonMurnane
Copy link

im trying to either make read-env package work or to access a variable by process.env[var1+'_loginUrl']

@mrsteele
Copy link
Owner

The latter should work if it defined in your .env file and you have it configured correctly. You might have to give me a little more information on the issue you are facing for me to help more.

@BrandonMurnane
Copy link
Author

so i have in my env file LEMON_PASSWORD=grape. but in my app.jsx i cant do
var name = "LEMON" ;
var password = process.env[name+"_PASSWORD"];
im trying to access them dynamically

@mrsteele
Copy link
Owner

Ahhhh, I see. Yeah I don't think that would work

We look exclusively for the named variables. We do this so that we do not accidentally expose all variables to the user.

You can read more about it here: #70 (comment)

Since this is sort of related to that comment, I'm going to close for now as it falls in as a duplicate, but I appreciate you bringing this to my attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants