Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

acconfig

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acconfig

config client

latest
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

#使用说明

ACConfigServer客户端

##安装

npm install [--save] acconfig

##使用

var AcConfig = require('acconfig');

var acConfig = new AcConfig({
    version:'1.0.1', //版本号
    url:'http://config.domain.com/apps/config', //配置服务器地址
    env:'test', //配置环境,'local'读取本地配置
    appName:'TestApp', //应用名称
    appKey:'testAppSecretKey' //应用key
});

var testAppConfig = null;

//方法一:
acConfig.loadConfigs(function(err, config){
    if(!err){
        //可以在loadConfigs的回调中直接获取配置
        testAppConfig = config;
    }
}); 

//方法二:
acConfig.loadConfigs();
//如果已经调用过loadConfigs(),可以直接按以下方法使用
testAppConfig = acconfig.configs; 

如果env为local,将从本地cwd目录下的的config/config.json 读取配置。

FAQs

Package last updated on 30 Jun 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