🚀Go client for ctrip/apollo (https://github.com/ctripcorp/apollo)
English | 中文
A Golang client for the configuration center framework Apollo.
go get -u github.com/apolloconfig/agollo/v4@latest
package main
import (
"fmt"
"github.com/apolloconfig/agollo/v4"
"github.com/apolloconfig/agollo/v4/env/config"
)
func main() {
c := &config.AppConfig{
AppID: "testApplication_yang",
Cluster: "dev",
IP: "http://localhost:8080",
NamespaceName: "dubbo",
IsBackupConfig: true,
Secret: "6ce3ff7e96a24335a9634fe9abca6d51",
}
client, _ := agollo.StartWithConfig(func() (*config.AppConfig, error) {
return c, nil
})
fmt.Println("Apollo configuration initialized successfully")
//Use your apollo key to test
cache := client.GetConfigCache(c.NamespaceName)
value, _ := cache.Get("key")
fmt.Println(value)
}
Demo Project: agollo_demo
Other Languages:: Use agollo-agent as a local agent for languages like PHP.
Check out our Wiki or godoc for more information.
If you find this tool useful or encounter any issues, please let me know via email or by creating an issue。
The project is licensed under the Apache 2 license.