DEV Community

Discussion on: How to Use Environment Variables in Vue.js

Collapse
 
kamalhm profile image
Kamal

Whoa so this is environment variables!

So when people initialize express port as
process.env.PORT || 5000, we will have to create .env file which has variable PORT in it, right?

Is this environment variables only a thing in JS ecosystem or also applies to other?

Collapse
 
ratracegrad profile image
Jennifer Bland

Not really. You want to store items that you don't want people to have access to. The port your server is running on is not necessarily a secret. If you are say using firebase for authentication then you would not want your firebase API keys available to everyone. In that case you would put that information in your .env file.

Collapse
 
thedamon profile image
Damon Muma

If I have config that isn't secret but does change from environment to environment I personally would store it in an env file that isn't in the gitignore. Do you recommend a different approach?