Implémenter NewApiClientFromViper()
Remplacer api.New() par api.NewApiClientFromViper() à certains endroits de serverCmd Remplacer hard-coded api protocol et host par viper où api.New() est encore utilisé
This commit is contained in:
parent
04de5cdad2
commit
d6a16a7222
2 changed files with 24 additions and 9 deletions
|
@ -617,10 +617,7 @@ func handleVieEtudianteOrganisme(c echo.Context) error {
|
|||
}
|
||||
|
||||
func handleDocumentation(c echo.Context) error {
|
||||
client, err := api.New("http", "localhost", cfg.Server.Port, api.APIOptions{
|
||||
KeyAuth: cfg.Server.Api.Auth,
|
||||
Key: cfg.Server.Api.Key,
|
||||
})
|
||||
client, err := api.NewApiClientFromViper()
|
||||
if err != nil {
|
||||
return c.Render(http.StatusInternalServerError, "documentation-html", nil)
|
||||
}
|
||||
|
@ -689,10 +686,7 @@ func handleFormulaires(c echo.Context) error {
|
|||
}
|
||||
|
||||
func handlePublicDocumentation(c echo.Context) error {
|
||||
client, err := api.New("http", "localhost", cfg.Server.Port, api.APIOptions{
|
||||
KeyAuth: cfg.Server.Api.Auth,
|
||||
Key: cfg.Server.Api.Key,
|
||||
})
|
||||
client, err := api.NewApiClientFromViper()
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusNotFound, map[string]string{"message": "Not Found"})
|
||||
}
|
||||
|
@ -725,7 +719,7 @@ func handleAdminDocumentsUpload(c echo.Context) error {
|
|||
}
|
||||
|
||||
func handleAdminDocumentsUploadPOST(c echo.Context) error {
|
||||
client, err := api.New("http", "localhost", cfg.Server.Port, api.APIOptions{
|
||||
client, err := api.New(cfg.Server.Api.Protocol, cfg.Server.Api.Host, cfg.Server.Port, api.APIOptions{
|
||||
KeyAuth: cfg.Server.Api.Auth,
|
||||
Key: cfg.Server.Api.Key,
|
||||
BasicAuth: cfg.Server.Admin.Auth,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue