1.4.0 • Published 6 years ago

ddconsul v1.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

ddconsul

dianda simple consul client based on node-consul

usage

npm install ddconsul --save
var ddconsul = require('ddconsul');

var consul = new ddconsul();
consul.pull().then(function(config){
    // ...
})

说明

new ddconsul(options)

  • options
  • options.host consul host,默认process.env.consulHost
  • options.port consul port,默认process.env.consulPort
  • options.ref 挂载config的对象,默认global
  • options.timeout 连接consul服务的超时时间,默认2000ms

consul.pull(options)

  • options
  • options.env 指定运行环境,默认当前环境
  • options.appName 指定系统名称,默认取package.json中的name
  • options.localPath 本地配置文件目录,默认/path/to/project/config
  • options.localFile 本地配置文件名称,默认config.local.json

注意

本地开发最好配置一下环境变量,设置开发环境的consul地址

# 添加环境变量,zsh配置 ~/.zshrc
export consulHost=""
export consulPort=8500
export CLIENT_NAME='dianda'
source ~/.zshrc
1.4.0

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago