Node.js: Setting Environment Variables -


i'm trying follow tutorial , says:

"there few ways load credentials.

  1. loaded environment variables,
  2. loaded json file on disk,

the keys need follows:

user_id, user_key 

...this means if set environment variables, not need manage credentials in application @ all."

based on googling, appears need set variables in process.env? how , set these credentials? example please.

environment variables (in case) being used pass credentials application. user_id , user_key can both accessed process.env.user_id , process.env.user_key respectively. don't need edit them, access contents.

it looks giving choice between loading user_id , user_key either process.env or specificed file on disk.

now, magic happens when run application.

user_id=239482 user_key=foobar node app.js

that pass user id 239482 , user key foobar. suitable testing, production, configuring bash scripts export variables.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -