【文件属性】:
文件名称:env-conf-loader:使用 env 自动加载配置文件
文件大小:5KB
文件格式:ZIP
更新时间:2021-06-25 10:40:47
JavaScript
env-conf-loader
为什么?
从文件/目录加载配置文件,并通过对象的键和环境变量合并对象。
安装
npm install env-conf-loader
用法
var loader = require ( 'env-conf-loader' )
加载一个json文件
foo.json
{
" bar " : 0 ,
" default " : { " bar " : 1 },
" production " : { " bar " : 2 , },
" development " : { " bar " : 3 , }
}
var conf = loader ( './foo.json' )
// NODE_ENV is undefined
console . log ( conf . bar ) // 1
// NODE_ENV is producti
【文件预览】:
env-conf-loader-master
----.travis.yml(38B)
----index.js(1KB)
----package.json(556B)
----test()
--------index.js(651B)
----README.zh-CN.md(2KB)
----configs()
--------data()
--------foo.yml(88B)
----.gitignore(13B)
----README.md(2KB)