Module tantowi/gini
is a Go module to read INI format configuration file
If we have configuration file in INI format like this :
[setting]
color=red
width=700
height=450
[server]
host=10.10.20.20
port=3344
First, import the library
import (
"github.com/tantowi/gini"
)
Then load the file :
ini, err := gini.LoadFile("/etc/myapp/config.ini")
if err != nil {
fmt.Println(err.Error())
return
}
And read the value :
color := ini.Read("setting", "color")
width := ini.Read("setting", "width")
height := ini.Read("setting", "height")
host := ini.Read("server", "host")
port := ini.Read("server", "port")
Copyright © 2020 Tantowi Mustofa, ttw@tantowi.com
Licensed under MIT License