Added greater granularity for boolean environment variables (#511)

* Added greater granularity for boolean environment variables

* Improved solution as reviewed
This commit is contained in:
Alessandro Detta
2024-02-22 11:35:53 +01:00
committed by GitHub
parent 3d7f907a33
commit b5bed10571
7 changed files with 73 additions and 11 deletions

View File

@@ -4,12 +4,12 @@ import (
"context"
"html"
"net/http"
"os"
"path"
"github.com/gin-gonic/gin"
"github.com/komodorio/helm-dashboard/pkg/dashboard/handlers"
"github.com/komodorio/helm-dashboard/pkg/dashboard/objects"
"github.com/komodorio/helm-dashboard/pkg/dashboard/utils"
"github.com/komodorio/helm-dashboard/pkg/frontend"
log "github.com/sirupsen/logrus"
)
@@ -95,7 +95,7 @@ func NewRouter(abortWeb context.CancelFunc, data *objects.DataLayer, debug bool)
api.Use(errorHandler)
api.Use(corsMiddleware())
if os.Getenv("HD_CORS") != "" {
if utils.EnvAsBool("HD_CORS", false) {
api.Use(allowCORS)
}