I was trying to find the best way of utilising a config file in my projects, i.e. for reading in usernames, tokens, passwords etc.
I began by just using a config.json
and then parsing that in another file to access the parameters. Then I came across this answer using a config.js
instead.
But this got me thinking about the way environment variables can be accessed.
What is to stop some node package I download from grabbing my process.env
config.twitter.password = process.env.TWITTER_PASSWORD
and then firing off a HTTP request with it to some external database, thereby leaking any passwords/tokens I might have stored as environment variables?
I have a feeling I'm being both naive and also missing something important, so I'd appreciate some instruction. Thanks.