fix bug: component check

This commit is contained in:
skiffer-git 2024-03-08 23:36:13 +08:00
parent 9434530f69
commit 979913aa93

View File

@ -79,7 +79,6 @@ func main() {
fmt.Printf("configGetEnv failed, err:%v", err) fmt.Printf("configGetEnv failed, err:%v", err)
return return
} }
checks := []checkFunc{ checks := []checkFunc{
//{name: "Mysql", function: checkMysql}, //{name: "Mysql", function: checkMysql},
@ -112,29 +111,30 @@ func main() {
continue continue
} }
allSuccess = false allSuccess = false
component.ErrorPrint(fmt.Sprintf("Check component: %s, failed: %+v", check.name, err)) component.ErrorPrint(fmt.Sprintf("Check component: %s, failed: %+v", check.name, err))
break break
}
checks[index].flag = true
component.SuccessPrint(fmt.Sprintf("%s connected successfully", check.name))
} }
checks[index].flag = true }
component.SuccessPrint(fmt.Sprintf("%s connected successfully", check.name))
if allSuccess {
component.SuccessPrint("All components started successfully!")
return
} }
} }
component.ErrorPrint("Some components checked failed!")
if allSuccess { os.Exit(-1)
component.SuccessPrint("All components started successfully!")
return
}
} }
component.ErrorPrint("Some components checked failed!")
os.Exit(-1) var errMinioNotEnabled = errors.New("minio.Enable is not configured to use MinIO")
var errSignEndPoint = errors.New("minio.signEndPoint contains 127.0.0.1, causing issues with image sending")
var errApiURL = errors.New("object.apiURL contains 127.0.0.1, causing issues with image sending")
} }
var errMinioNotEnabled = errors.New("minio.Enable is not configured to use MinIO")
var errSignEndPoint = errors.New("minio.signEndPoint contains 127.0.0.1, causing issues with image sending")
var errApiURL = errors.New("object.apiURL contains 127.0.0.1, causing issues with image sending")
// checkMongo checks the MongoDB connection without retries // checkMongo checks the MongoDB connection without retries
func checkMongo(config *config.GlobalConfig) error { func checkMongo(config *config.GlobalConfig) error {
mongoStu := &component.Mongo{ mongoStu := &component.Mongo{