https://github.com/ilya1st/configuration-go
Golang library to ease work with configuration files. For now with HJSON
https://github.com/ilya1st/configuration-go
config configuration golang hjson
Last synced: 6 months ago
JSON representation
Golang library to ease work with configuration files. For now with HJSON
- Host: GitHub
- URL: https://github.com/ilya1st/configuration-go
- Owner: ilya1st
- License: mit
- Created: 2017-09-29T15:38:24.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-09-03T22:30:05.000Z (almost 4 years ago)
- Last Synced: 2024-06-20T10:22:01.899Z (about 2 years ago)
- Topics: config, configuration, golang, hjson
- Language: Go
- Homepage:
- Size: 858 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# configuration-go
[](https://travis-ci.org/ilya1st/configuration-go)[](https://goreportcard.com/report/github.com/ilya1st/configuration-go)
The configuration-go package intended for normal work with configuration files.
For now we support HJSON format three-like configs.
Library is intended to ease getting configuration file values if you know path to them
## Install
Make sure you have a working Go environment. See the [install instructions](http://golang.org/doc/install.html).
$ go get -u github.com/ilya1st/configuration-go
## Usage as command line tool
Sample:
For example: we have file test.hjson
## Usage as a GO library
```go
package main
import(
"fmt"
"github.com/ilya1st/configuration-go"
)
func main(){
config, err:=configuration.GetConfigInstance("mainconfig", "HJSON", "test.hjson")
if err != nil {
fmt.Printf("Error occurred %v\n", err);
}
val, err:=config.GetValue("section1", "subsection2", "value")
fmt.Printf("getting section1/subsection2/value: val=%v, error=%v\n", val, err)
val, err=config.GetValue("test")
fmt.Printf("getting test: val=%v, error=%v\n", val, err)
}
```
See examples directory.