【发布时间】:2016-04-15 21:01:04
【问题描述】:
在 node.js 中,你可以使用 'require()' 加载您的配置文件,但我厌倦了必须在我的所有程序上这样做。有没有办法让 node.js 自动加载配置文件?
【问题讨论】:
-
显式总是比隐式好。不要偷懒。
标签: node.js shell command-line config configuration-files
在 node.js 中,你可以使用 'require()' 加载您的配置文件,但我厌倦了必须在我的所有程序上这样做。有没有办法让 node.js 自动加载配置文件?
【问题讨论】:
标签: node.js shell command-line config configuration-files
没关系。我发现你可以通过将它放在你的 '.bash_profile' 或 unix 机器上的 shell 配置文件中来做到这一点:
alias node='node -r ./config.js'
【讨论】: