go-chassis-config is able to pull configs from heterogeneous distributed configuration
management service.
it is decoupled with go chassis. you can use it directly without go chassis.
Supported distributed configuration management service:
name | import | description |
---|---|---|
config_center | github.com/go-chassis/go-chassis-config/configcenter | huawei cloud CSE config center https://www.huaweicloud.com/product/cse.html |
apollo(not longer under maintenance) | github.com/go-chassis/go-chassis-config/apollo | ctrip apollo https://github.com/ctripcorp/apollo |
servicecomb-kie | github.com/apache/servicecomb-kie/client/adaptor | apache servicecomb-kie https://github.com/apache/servicecomb-kie |
Get a client of config center
- import the config client you want to use
import _ "github.com/go-chassis/go-chassis-config/configcenter"
- Create a client
c, err := ccclient.NewClient("config_center", ccclient.Options{
ServerURI: "http://127.0.0.1:30200",
})
import (
"github.com/huaweicse/auth"
"github.com/go-chassis/foundation/httpclient"
_ "github.com/go-chassis/go-chassis-config/configcenter"
)
func main() {
var err error
httpclient.SignRequest,err =auth.GetShaAKSKSignFunc("your ak", "your sk", "")
if err!=nil{
//handle err
}
ccclient.NewClient("config_center",ccclient.Options{
ServerURI:"the address of CSE endpoint",
})
}