From d43ddf4e8222d0d79bc1fe8ca605b74fa869a67e Mon Sep 17 00:00:00 2001 From: lukaszcl <120112546+lukaszcl@users.noreply.github.com> Date: Wed, 18 Sep 2024 12:10:40 +0200 Subject: [PATCH] Add E2E_TEST_GRAFANA_BASE_URL_GAP_ENV --- lib/config/env.go | 1 + lib/config/testconfig.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/config/env.go b/lib/config/env.go index 86d5fe006..5a853854e 100644 --- a/lib/config/env.go +++ b/lib/config/env.go @@ -20,6 +20,7 @@ const ( E2E_TEST_LOKI_BASIC_AUTH_ENV = "E2E_TEST_LOKI_BASIC_AUTH" E2E_TEST_LOKI_BEARER_TOKEN_ENV = "E2E_TEST_LOKI_BEARER_TOKEN" // #nosec G101 E2E_TEST_GRAFANA_BASE_URL_ENV = "E2E_TEST_GRAFANA_BASE_URL" + E2E_TEST_GRAFANA_BASE_URL_GAP_ENV = "E2E_TEST_GRAFANA_BASE_URL_GAP" E2E_TEST_GRAFANA_DASHBOARD_URL_ENV = "E2E_TEST_GRAFANA_DASHBOARD_URL" E2E_TEST_GRAFANA_BEARER_TOKEN_ENV = "E2E_TEST_GRAFANA_BEARER_TOKEN" // #nosec G101 E2E_TEST_PYROSCOPE_ENABLED_ENV = "E2E_TEST_PYROSCOPE_ENABLED" diff --git a/lib/config/testconfig.go b/lib/config/testconfig.go index afe287fa6..6354ec717 100644 --- a/lib/config/testconfig.go +++ b/lib/config/testconfig.go @@ -143,6 +143,18 @@ func (c *TestConfig) ReadFromEnvVar() error { c.Logging.Grafana.BaseUrl = &grafanaBaseUrl } + grafanaBaseUrlGap := MustReadEnvVar_String(E2E_TEST_GRAFANA_BASE_URL_GAP_ENV) + if grafanaBaseUrlGap != "" { + if c.Logging == nil { + c.Logging = &LoggingConfig{} + } + if c.Logging.Grafana == nil { + c.Logging.Grafana = &GrafanaConfig{} + } + logger.Info().Msgf("Using %s env var to override Logging.Grafana.BaseUrlGap", E2E_TEST_GRAFANA_BASE_URL_GAP_ENV) + c.Logging.Grafana.BaseUrlGap = &grafanaBaseUrlGap + } + grafanaDashboardUrl := MustReadEnvVar_String(E2E_TEST_GRAFANA_DASHBOARD_URL_ENV) if grafanaDashboardUrl != "" { if c.Logging == nil {