百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

agollo

> 开发工具
开源

agollo 是一个用于携程 Apollo 配置中心的 Golang 客户端

182 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

agollo 是一个用于携程 Apollo 配置中心的 Golang 客户端

agollo is a golang client for apollo

v1: v3: v4:

Feature

  • Multiple namespace support
  • Fail tolerant
  • Zero dependency
  • Realtime change notification
  • API to get contents of namespace

Required

go 1.11 or later

Installation

bash
go get -u github.com/philchia/agollo/v4

Usage

Import agollo

go
import "github.com/philchia/agollo/v4"

In order to use agollo, issue a client or use the built-in default client

to use the default global client

for namespaces with the format of properties, you need to specific the full name

go
agollo.Start(&agollo.Conf{
    AppID:          "your app id",
    Cluster:        "default",
    NameSpaceNames: []string{"application.properties"},
    MetaAddr:       "your apollo meta addr",
})

or to issue a new client to embedded into your program

go
apollo := agollo.New(&agollo.Conf{
                            AppID:          "your app id",
                            Cluster:        "default",
                            NameSpaceNames: []string{"application.properties"},
                            MetaAddr:       "your apollo meta addr",
                        })
apollo.Start()

Set config update callback

go
agollo.OnUpdate(func(event *ChangeEvent) {
    // do your business logic to handle config update
})

Get apollo values

go
// get values in the application.properties default namespace
val := agollo.GetString(Key)
// or indicate a namespace
other := agollo.GetString(key, agollo.WithNamespace("other namespace"))

Get namespace file contents

to get namespace of with a format of properties, you need to specific the full name of the namespace, e.g. namespace.properties in both options and configs

go
namespaceContent := agollo.GetContent(agollo.WithNamespace("application.properties"))

Get all keys

go
allKyes := agollo.GetAllKeys(namespace)

Subscribe to new namespaces

go
agollo.SubscribeToNamespaces("newNamespace1", "newNamespace2")

License

agollo is released under MIT license

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goagolloapolloclientctrip

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类开发工具
定价开源

> 相关工具

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具