Can't read my environment variable in my Node.js app

后端 未结 4 664
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-02 15:10

I am on Ubuntu 12.04 and I\'m just learning about environment variables. I am trying to read a custom variable from within my application but it always shows up as undefin

4条回答
  •  温柔的废话
    2021-02-02 15:40

    You might want to consider using a library for managing app configuration.

    For example nconf helps manage configuration through

    • command line argumets
    • environment variables
    • files
    • etc..

    And looking at the source is a nice way to learn https://github.com/flatiron/nconf

提交回复
热议问题