Socket
Socket
Sign inDemoInstall

ez-config-loader

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ez-config-loader

根据环境变量 `NODE_ENV` 加载 JSON 格式的 Config 文件


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Ez Config Loader

加载 Json 格式的配置文件

支持根据环境变量 NODE_ENV 加载不同的配置文件,用于方便开发环境与生产环境调用不同的资源

安装

$ npm install ez-config-loader --save

用法

var configLoader = require('ez-config-loader');
var config = configLoader('path2config/config'); 

未设定环境变量情况下

将会加载 ./path2config/config.json 文件

设定环境变量情况下

$ exports NODE_ENV=development 将会加载 ./path2config/config.development.json

临时应用环境变量

NODE_ENV=temp node yourapp.js 将会加载 ./path2config/config.temp.json

如果不能指定环境变量的配置文件

如果未成功加载环境变量指定的配置文件,将会按照未指定环境变量方式加载

test

npm test

FAQs

Package last updated on 04 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc