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)
| 99 | // @Success 200 {object} handler.RespBody{data=install.CheckConfigFileResp{}} |
| 100 | // @Router /installation/config-file/check [post] |
| 101 | func 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 |
nothing calls this directly
no test coverage detected