示例#1
0
文件: config.go 项目: pistarlabs/core
// LoadConfig load configuration file
func LoadConfig(path string) {
	var err error
	Config, err = configs.Load(path)
	if err != nil {
		panic(err)
	}
}
示例#2
0
func init() {
	var err error

	cfg, err = configs.Load("./config.json")
	if err != nil {
		panic(err)
	}

	token = cfg.UString("token")
}
示例#3
0
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"))
}