Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rosenpin/go-config-manager
Manage and load configuration files easily in GoLang
https://github.com/rosenpin/go-config-manager
Last synced: about 1 month ago
JSON representation
Manage and load configuration files easily in GoLang
- Host: GitHub
- URL: https://github.com/rosenpin/go-config-manager
- Owner: rosenpin
- Created: 2018-12-22T14:13:57.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-07T19:13:07.000Z (over 5 years ago)
- Last Synced: 2024-11-26T23:32:56.072Z (about 2 months ago)
- Language: Go
- Size: 1.95 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Configuration Manager
## Installation
```go get https://gitlab.com/rosenpin/config-manager```## Usage
1. Create a configuration struct for your project. IE: models.Config
``` go
type Config struct {
Path
Port
Username
...
}
```
2. Create the configuration file. IE: config.yaml
``` yaml
Path: /home/user/projectpath
Port: 8080
Username: rosenpin
```
3. Load the configuration
``` go
configLoader := config.NewLoader("config.yaml")config := &models.Config{}
err := configLoader.Load(yaml.Unmarshal, config)
if err != nil {
panic(err)
}
```