Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

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)
}
```