Utiliser api.NewApiClientFromViper

This commit is contained in:
Victor Lacasse-Beaudoin 2023-08-19 15:23:10 -04:00
parent a4b56214b2
commit 25aaad42b6

View file

@ -441,13 +441,7 @@ func handleAdminDocumentsUploadPOST(c echo.Context) error {
Message string Message string
} }
client, err := api.New(cfg.Server.Api.Protocol, cfg.Server.Api.Host, cfg.Server.Port, api.APIOptions{ client, err := api.NewApiClientFromViper()
KeyAuth: cfg.Server.Api.Auth,
Key: cfg.Server.Api.Key,
BasicAuth: cfg.Server.Admin.Auth,
Username: cfg.Server.Admin.Username,
Password: cfg.Server.Admin.Password,
})
if err != nil { if err != nil {
data.Message = fmt.Sprintf("handleAdminDocumentsUploadPOST#api.New: %s", err) data.Message = fmt.Sprintf("handleAdminDocumentsUploadPOST#api.New: %s", err)
return c.Render(http.StatusInternalServerError, "admin-upload-html", data) return c.Render(http.StatusInternalServerError, "admin-upload-html", data)