This project is in early developing. We need your help to make it perfect
Another easy way for configuration
go get -u github.com/Jel1ySpot/conicBy binding variable and configuration, you can access and change the configuration in a easy way.
Configuration (usually a file) <=> Go Variable
package main
import (
"fmt"
"github.com/Jel1ySpot/conic"
)
type Config struct {
Name string `json:"name"`
Age int `json:"age"`
}
func main() {
config := Config{}
// Binding
conic.BindRef("", &config)
// Read configuration file
conic.SetConfigFile("config.json")
conic.ReadConfig()
conic.WatchConfig()
/* config.json
{
"name": "alex",
"age": 21
}
*/
fmt.Printf("&v", config)
// Change value
config.Name = "Richard"
config.Age += 7
conic.WriteConfig()
/* config.json
{
"name": "Richard",
"age": 28
}
*/
}