https://github.com/xmlking/config-plane
Push config changes to all subscribing clients
https://github.com/xmlking/config-plane
Last synced: about 1 year ago
JSON representation
Push config changes to all subscribing clients
- Host: GitHub
- URL: https://github.com/xmlking/config-plane
- Owner: xmlking
- Created: 2021-05-28T14:29:54.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-28T18:34:32.000Z (almost 5 years ago)
- Last Synced: 2025-01-30T05:43:17.719Z (about 1 year ago)
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# config-plane
Push config changes to all subscribing clients
## Requirements
- [ ] Provider source plugins (GitHub, Filesystem, database)
- [ ] Implement as Kubernetes Operator
- [ ] Management Dashboard (view subscribers, providers, current config set)
- [ ] Log config changes to changelog file
- [ ] expose gRPC API to pull/push/stream config changes
## Client
```go
ctx := context.Background()
client, err := config.NewClient(ctx, "config-plane-url")
if err != nil {
return fmt.Errorf("config.NewClient: %v", err)
}
defer client.Close()
var mu sync.Mutex
var changelog []string
sub := client.Subscription("/config/**/*")
cctx, cancel := context.WithCancel(ctx)
err = sub.Receive(cctx, func(ctx context.Context, cSet []string) {
mu.Lock()
defer mu.Unlock()
fmt.Fprintf(w, "Got changeset: %v\n", cSet)
// do something with changes
changelog = append(changelog, cSet)
// cancel when don't needed
// cancel()
})
if err != nil {
fmt.Errorf("Receive: %v", err)
}
fmt.Fprintf(w, "changelog: %v\n", changelog)
```