From 979913aa936eff42949131a45dfacc80ae382f29 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Fri, 8 Mar 2024 23:36:13 +0800 Subject: [PATCH] fix bug: component check --- tools/component/component.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/component/component.go b/tools/component/component.go index 5c8ed71d5..c9a552c5c 100644 --- a/tools/component/component.go +++ b/tools/component/component.go @@ -79,7 +79,6 @@ func main() { fmt.Printf("configGetEnv failed, err:%v", err) return } - checks := []checkFunc{ //{name: "Mysql", function: checkMysql}, @@ -112,29 +111,30 @@ func main() { continue } - allSuccess = false - component.ErrorPrint(fmt.Sprintf("Check component: %s, failed: %+v", check.name, err)) - break + allSuccess = false + component.ErrorPrint(fmt.Sprintf("Check component: %s, failed: %+v", check.name, err)) + 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 } } - - if allSuccess { - component.SuccessPrint("All components started successfully!") - return - } + component.ErrorPrint("Some components checked failed!") + os.Exit(-1) } - 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 func checkMongo(config *config.GlobalConfig) error { mongoStu := &component.Mongo{