Go MyCMS ConfigFile
This package is an utility to read config files
The project configuration can be stored on the following file types:
Versions
Current version is v1.0.2-alpha
Install
In your go project, run the following command
go get github.com/Lucas-Palomo/go-mycms-configfile@latest
Parse Example
This is toml configuration file.
[database]
host="localhost"
port=3306
username="root"
password="toor"
Calling toml configuration is easy, see the bellow code:
package main
import (
ConfigFile "github.com/Lucas-Palomo/go-mycms-configfile/configfile"
)
type Conf struct {
DB DatabaseConf `toml:"database"`
}
type DatabaseConf struct {
Host string `toml:"host"`
Port int `toml:"port"`
Username string `toml:"username"`
Password string `toml:"password"`
}
func main() {
conf := Conf{}
ConfigFile.ReadFile("/home/user/config.toml", &conf, ConfigFile.TOML)
// Now conf has all populated values
}