// LoadConfig load configuration file func LoadConfig(path string) { var err error Config, err = configs.Load(path) if err != nil { panic(err) } }
func init() { var err error cfg, err = configs.Load("./config.json") if err != nil { panic(err) } token = cfg.UString("token") }
func main() { // Initialize config cfg, err := configs.Load("/path/toconfig.json") if err != nil { panic(err) } // Get development environment configuration cfg, err = cfg.Get("development") if err != nil { panic(err) } fmt.Printf("Database host is %s", cfg.UString("database.host")) }