An open API service indexing awesome lists of open source software.

https://github.com/protoconf/client-go


https://github.com/protoconf/client-go

Last synced: 16 days ago
JSON representation

Awesome Lists containing this project

README

          


project-logo




Protoconf GOLANG client


codify configuration, instant delivery



license
last-commit




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.