go micro config parser
- Tested and used in production
- Zero memory allocations
- KISS principle "Keep it simple, stupid"
- No dependencies
-
Get package:
go get github.com/microcodebase/microconfig
-
Import it in your code:
import "github.com/microcodebase/microconfig"
-
Load config file:
conf, err := microconfig.ParseFile("zzz.conf")
-
Parse config from string or []byte:
conf := microconfig.Parse([]byte("a = 1"))
-
Config are read to string map:
var conf map[string]string = microconfig.Parse([]byte("key = value")) value := conf["key"]
# a config comment
# support the name = value format
Port=8000
# support spaces
key1 = some value
key2 = some other value