https://github.com/zneix/yec
Golang config library with minimal dependencies
https://github.com/zneix/yec
Last synced: over 1 year ago
JSON representation
Golang config library with minimal dependencies
- Host: GitHub
- URL: https://github.com/zneix/yec
- Owner: zneix
- License: mit
- Created: 2021-08-21T03:37:57.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-21T14:15:46.000Z (almost 5 years ago)
- Last Synced: 2025-03-08T01:03:14.431Z (over 1 year ago)
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yec: YAML-env-config wrapper for Golang
Yec is a simple library that reads data from yaml files and environment variables unmarshaling it into custom structs.
It aims to be as lightweight as possible, relying on minimal amount of dependencies, while providing unified functionality between configuration files and environment variables.
Simple example:
```go
package main
import (
"fmt"
"github.com/zneix/yec"
)
type myConfig struct {
BaseURL string `mapstructure:"base-url"`
MaxContentLength uint64 `mapstructure:"max-content-length"`
}
func main() {
y := yec.New("myapplication")
y.ReadConfig()
var cfg myConfig
y.Unmarshal(&cfg)
fmt.Printf("%# v\n", cfg)
}
```
Inspired by [spf13/viper](https://github.com/spf13/viper).