- Multiple namespace support
- Fail tolerant
- Zero dependency
- Realtime change notification
go 1.9 or later
go get -u github.com/philchia/agollo/v4
import "github.com/philchia/agollo/v4"
agollo.Start(&agollo.Conf{
AppID: "your app id",
Cluster: "your cluster",
NameSpaceNames: []string{"namespaces you want to subscribe to"},
CacheDir: "",
MetaAddr: "your apollo meta addr",
})
apollo := agollo.New(&agollo.Conf{
AppID: "your app id",
Cluster: "your cluster",
NameSpaceNames: []string{"namespaces you want to subscribe to"},
CacheDir: "",
MetaAddr: "your apollo meta addr",
})
apollo.Start()
agollo.OnUpdate(func(event *ChangeEvent) {
// do your business logic to handle config update
})
// get values in the application.properties default namespace
val := agollo.GetString(Key)
// or indicate a namespace
other := agollo.GetString(key, agollo.WithNamespace("other namespace"))
warn: currently GetContent do not support .properties namespace
namespaceContent := agollo.GetContent(agollo.WithNamespace("other namespace"))
allKyes := agollo.GetAllKeys(namespace)
agollo.SubscribeToNamespaces("newNamespace1", "newNamespace2")
agollo is released under MIT license