https://github.com/microcodebase/microconfig
go micro config parser
https://github.com/microcodebase/microconfig
config go golang parser properties
Last synced: 5 months ago
JSON representation
go micro config parser
- Host: GitHub
- URL: https://github.com/microcodebase/microconfig
- Owner: microcodebase
- License: mit
- Created: 2018-06-10T10:45:23.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-22T18:08:00.000Z (over 7 years ago)
- Last Synced: 2024-06-20T15:49:00.614Z (about 2 years ago)
- Topics: config, go, golang, parser, properties
- Language: Go
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```Shell
go get github.com/microcodebase/microconfig
```
2. Import it in your code:
```Go
import "github.com/microcodebase/microconfig"
```
## Usage
1. Load config file:
```Go
conf, err := microconfig.ParseFile("zzz.conf")
```
2. Parse config from string or []byte:
```Go
conf := microconfig.Parse([]byte("a = 1"))
```
3. Config are read to string map:
```Go
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
```