Skip to content

microcodebase/microconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

microconfig

go micro config parser

Features

  • Tested and used in production
  • Zero memory allocations
  • KISS principle "Keep it simple, stupid"
  • No dependencies

Installing

  1. Get package:

    go get github.com/microcodebase/microconfig
  2. Import it in your code:

    import "github.com/microcodebase/microconfig"

Usage

  1. Load config file:

    conf, err := microconfig.ParseFile("zzz.conf")
  2. Parse config from string or []byte:

    conf := microconfig.Parse([]byte("a = 1"))
  3. Config are read to string map:

    var conf map[string]string = microconfig.Parse([]byte("key = value"))
    value := conf["key"]

Configuration example

# a config comment

# support the name = value format
Port=8000

# support spaces
  key1 = some value
  key2 = some other value

Releases

No releases published

Packages

No packages published

Languages