Setting Environment Variables for Node to retrieve

前端 未结 16 1897
-上瘾入骨i
-上瘾入骨i 2020-11-22 15:41

I\'m trying to follow a tutorial and it says:

There are a few ways to load credentials.

  1. Loaded from environment variables,
16条回答
  •  北海茫月
    2020-11-22 16:33

    If you are using a mac/linux and you want to retrieve local parameters to the machine you're using, this is what you'll do:

    1. In terminal run nano ~/.bash_profile
    2. add a line like: export MY_VAR=var
    3. save & run source ~/.bash_profile
    4. in node use like: console.log(process.env.MY_VAR);

提交回复
热议问题