MCPcopy Index your code
hub / github.com/apache/answer / CheckConfigFile

Function CheckConfigFile

internal/install/install_controller.go:101–120  ·  view source on GitHub ↗

CheckConfigFile check config file if exist when installation @Summary check config file if exist when installation @Description check config file if exist when installation @Tags installation @Accept json @Produce json @Success 200 {object} handler.RespBody{data=install.CheckConfigFileResp{}} @Route

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

99// @Success 200 {object} handler.RespBody{data=install.CheckConfigFileResp{}}
100// @Router /installation/config-file/check [post]
101func CheckConfigFile(ctx *gin.Context) {
102 resp := &CheckConfigFileResp{}
103 resp.ConfigFileExist = cli.CheckConfigFile(confPath)
104 if !resp.ConfigFileExist {
105 handler.HandleResponse(ctx, nil, resp)
106 return
107 }
108 allConfig, err := conf.ReadConfig(confPath)
109 if err != nil {
110 log.Error(err)
111 err = errors.BadRequest(reason.ReadConfigFailed)
112 handler.HandleResponse(ctx, err, nil)
113 return
114 }
115 resp.DBConnectionSuccess = cli.CheckDBConnection(allConfig.Data.Database)
116 if resp.DBConnectionSuccess {
117 resp.DbTableExist = cli.CheckDBTableExist(allConfig.Data.Database)
118 }
119 handler.HandleResponse(ctx, nil, resp)
120}
121
122// CheckDatabase check database if exist when installation
123// @Summary check database if exist when installation

Callers

nothing calls this directly

Calls 5

CheckConfigFileFunction · 0.92
HandleResponseFunction · 0.92
ReadConfigFunction · 0.92
CheckDBConnectionFunction · 0.92
CheckDBTableExistFunction · 0.92

Tested by

no test coverage detected