Beispiel #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)
	user.SetClient(webapi.GetClient())
	return nil
}
Beispiel #2
0
func InitMySqlClient() error {
	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)
	Client = client
	mysql.SetClient(client)
	user.SetClient(client)
	return nil
}