https://github.com/protoconf/client-go
https://github.com/protoconf/client-go
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/protoconf/client-go
- Owner: protoconf
- License: mit
- Created: 2024-06-17T03:26:21.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-03-06T21:41:52.000Z (19 days ago)
- Last Synced: 2026-03-07T01:33:36.276Z (19 days ago)
- Language: Go
- Size: 92.8 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Protoconf GOLANG client
codify configuration, instant delivery
Table of Contents
- [📍 Overview](#-overview)
- [🧩 Features](#-features)
- [⚙️ Installation](#️-installation)
- [🤖 Usage](#-usage)
- [🤝 Contributing](#-contributing)
- [🎗 License](#-license)
## 📍 Overview
`protoconf_loader` is a Go package that provides a flexible and robust configuration management solution.
It supports loading configuration from files, watching for file changes, and subscribing to configuration updates from a Protoconf server.
---
## 🧩 Features
- Load configuration from files
- Watch configuration files for changes
- Subscribe to configuration updates from a Protoconf server
- Hot Reload of configuration changes
- Thread-safe access to configuration values
- Support for various data types (int32, int64, uint32, uint64, float32, float64, bool, string)
- Custom error handling and logging
## ⚙️ Installation
To install the package, use the following command:
```bash
go get github.com/protoconf/client-go
```
## 🤖 Usage
Here's a basic example of how to use the protoconf_loader:
```go
package main
import (
"context"
"log"
"github.com/protoconf/client-go/"
"github.com/protoconf/protoconf/examples/protoconf/src/crawler"
"google.golang.org/protobuf/proto"
)
func main() {
// Initialize the configuration with the default configuration.
crawlerConfig := &crawler.CrawlerService{LogLevel: 3}
// Create a new configuration instance
cfg, err := protoconf_loader.NewConfiguration(crawlerConfig, "path/to/config")
if err != nil {
log.Fatalf("Failed to create configuration: %v", err)
}
// Load the configuration
err = cfg.LoadConfig("path/to/config", "config_file_name")
if err != nil {
log.Fatalf("Failed to load configuration: %v", err)
}
config.OnConfigChange(func(c proto.Message) {
log("got new config",c)
})
// Start watching for changes
err = config.WatchConfig(context.Background())
if err != nil {
log.Fatalf("Failed to start watching configuration: %v", err)
}
// Stop watching when done
cfg.StopWatching()
}
```
## 🤝 Contributing
Contributions are welcome! Here are several ways you can contribute:
- **[Report Issues](https://github.com/protoconf/client-go/issues)**: Submit bugs found or log feature requests for the `client-go` project.
- **[Submit Pull Requests](https://github.com/protoconf/client-go/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs.
- **[Join the Discussions](https://discord.protoconf.sh/)**: Share your insights, provide feedback, or ask questions.
## 🎗 License
This project is protected under the [MIT](https://choosealicense.com/licenses/mit/) License.
For more details, refer to the [LICENSE](https://github.com/protoconf/client-go/blob/main/LICENSE) file.