From 274f1cd6cca33943f398ef203c2fef86188c732f Mon Sep 17 00:00:00 2001 From: Alessandro Detta <62752370+alessandrodetta@users.noreply.github.com> Date: Fri, 23 Feb 2024 21:37:43 +0100 Subject: [PATCH] Added ability to disable query to ArtifactHub via env (#515) It is now possible to disable the query through environment variable HD_NO_ARTIFACT_HUB_QUERY --- pkg/dashboard/handlers/helmHandlers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/dashboard/handlers/helmHandlers.go b/pkg/dashboard/handlers/helmHandlers.go index 84d11bd..0e716b3 100644 --- a/pkg/dashboard/handlers/helmHandlers.go +++ b/pkg/dashboard/handlers/helmHandlers.go @@ -241,6 +241,11 @@ func (h *HelmHandler) RepoLatestVer(c *gin.Context) { if len(res) > 0 { c.IndentedJSON(http.StatusOK, res[:1]) } else { + if utils.EnvAsBool("HD_NO_ARTIFACT_HUB_QUERY", false) { + c.Status(http.StatusNoContent) + return + } + // caching it to avoid too many requests found, err := h.Data.Cache.String("chart-artifacthub-query/"+qp.Name, nil, func() (string, error) { return h.repoFromArtifactHub(qp.Name)