Skip to content

Latest commit

 

History

History
64 lines (44 loc) · 1.69 KB

README_CN.md

File metadata and controls

64 lines (44 loc) · 1.69 KB

agollo 是携程 apollo 配置中心的 golang 客户端 🚀 CircleCI

Go Report Card codebeat badge Coverage Status golang GoDoc GitHub release

功能

  • 多 namespace 支持
  • 容错,本地缓存
  • 零依赖

依赖

go 1.9 或更新

安装

    go get -u github.com/philchia/agollo

使用

使用 app.properties 配置文件启动

    agollo.Start()

使用自定义配置启动

    agollo.StartWithConfFile(name)

监听配置更新

    events := agollo.WatchUpdate()
    changeEvent := <-event
    bytes, _ := json.Marshal(changeEvent)
    fmt.Println("event:", string(bytes))

获取配置

    agollo.GetStringValue(Key, defaultValue)
    agollo.GetStringValueWithNameSapce(namespace, key, defaultValue)

获取文件内容

    agollo.GetNameSpaceContent(namespace, defaultValue)

许可

agollo 使用 MIT 许可