func init() { // 设置日志文件的存储目录 logUtil.SetLogPath(filepath.Join(fileUtil.GetCurrentPath(), "LOG")) var err error // 读取配置文件内容 config, err := configUtil.ReadJsonConfig(CONFIG_FILE_NAME) checkError(err) ServerGroupId, err = configUtil.ReadIntJsonValue(config, "ServerGroupId") checkError(err) ServerActivateUrl, err = configUtil.ReadStringJsonValue(config, "ServerActivateUrl") checkError(err) GameDBConnection, err = configUtil.ReadStringJsonValue(config, "GameDBConnection") checkError(err) GameModelDBConnection, err = configUtil.ReadStringJsonValue(config, "GameModelDBConnection") checkError(err) DEBUG, err = configUtil.ReadBoolJsonValue(config, "DEBUG") checkError(err) // 激活服务器 err = manageUtil.ActivateServer(ServerActivateUrl, ServerGroupId) if err != nil { checkError(fmt.Errorf("激活服务器失败,错误信息为:", err)) } DBConnectionString = manageUtil.GetDBConnectionString() }
func init() { err := manageUtil.ActivateServer(manageCenterUrl, serverGroupId) if err != nil { panic(fmt.Sprintf("激活服务器失败,错误信息为:%s", err)) } }