示例#1
0
func InitWebApi() error {
	err := initWebApiConfig()
	if err != nil {
		Log.Error(err)
		os.Exit(0)
	}
	conf := muconfig.GetConf().WebApi
	webapi.SetClient(webapi.NewClient())
	webapi.SetBaseUrl(conf.Url)
	webapi.SetKey(conf.Key)
	webapi.SetNodeId(conf.NodeId)
	webapi.SetUserType(conf.UType)
	user.SetClient(webapi.GetClient())
	return nil
}
示例#2
0
func InitMySqlClient() error {
	initMysqlClientConfig()
	conf := muconfig.GetConf().Mysql
	client := new(mysql.Client)
	dbType := "mysql"
	dbuser := conf.User
	password := conf.Pass
	host := conf.Host
	dbname := conf.Db
	table := conf.Table

	err := client.Boot(dbType, dbuser, password, host, dbname)
	if err != nil {
		return err
	}
	client.SetTable(table)
	mysql.SetClient(client)
	user.SetClient(client)
	if err != nil {
		Log.Error(err)
		os.Exit(0)
	}
	return nil
}