Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

pull and push configs in distributed configuration management service. migrated to go-archaius https://github.com/go-chassis/go-archaius/pull/87

License

Notifications You must be signed in to change notification settings

go-chassis/go-chassis-config

Repository files navigation

go-chassis-config

Build Status
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

Example

Get a client of config center

  1. import the config client you want to use
import _ "github.com/go-chassis/go-chassis-config/configcenter"
  1. Create a client
c, err := ccclient.NewClient("config_center", ccclient.Options{
		ServerURI: "http://127.0.0.1:30200",
	})

Use huawei cloud

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",
	})
}