Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

agollo

> 开发工具
Open source

agollo is a golang client for ctrip apollo config center

182 stars0 likes0 views
WebsiteGitHub

About

agollo is a golang client for ctrip apollo config center

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 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Goagolloapolloclientctrip

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category开发工具
PricingOpen source

> Related tools

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