From 0759d10e1ab65739dba34ad312186e4f87c55bac Mon Sep 17 00:00:00 2001 From: FrancescoL96 Date: Wed, 29 Oct 2025 18:29:50 +0100 Subject: [PATCH 1/2] refactor: infer Snowplow URL from env variables --- main.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index ac9e396..1d9a319 100644 --- a/main.go +++ b/main.go @@ -55,8 +55,16 @@ func main() { env.String("AUTHN_KUBECONFIG_CLUSTER_NAME", "krateo"), "cluster name for generated kubeconfig") kubernetesURL := flag.String("kubeconfig-server-url", env.String("AUTHN_KUBECONFIG_SERVER_URL", ""), "kubernetes api server url for generated kubeconfig") - snowplowURL := flag.String("snowplow-url", - env.String("URL_SNOWPLOW", "http://snowplow.krateo-system.svc.cluster.local:8081"), "snowplow url for restaction api calls") + snowplowHOST := flag.String("snowplow-host", + env.String("SNOWPLOW_SERVICE_HOST", ""), "snowplow host for restaction api calls") + snowplowPORT := flag.String("snowplow-post", + env.String("SNOWPLOW_SERVICE_PORT", "8081"), "snowplow port for restaction api calls") + var snowplowURL *string + temp := "http://" + *snowplowHOST + ":" + *snowplowPORT + snowplowURL = &temp + if *snowplowURL == "http://:8081" { + snowplowURL = flag.String("snowplow-url", env.String("URL_SNOWPLOW", "http://snowplow.krateo-system.svc.cluster.local:8081"), "snowplow url for restaction api calls") + } storageNamespace := flag.String("namespace", env.String("AUTHN_NAMESPACE", ""), "namespace where to store secrets with generated config") authnUsername := flag.String("authn-username", From c68dd244b3295194d3a58b57d7df95405a151f80 Mon Sep 17 00:00:00 2001 From: FrancescoL96 Date: Wed, 29 Oct 2025 18:31:20 +0100 Subject: [PATCH 2/2] fix: improved logging --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index 1d9a319..d9005a1 100644 --- a/main.go +++ b/main.go @@ -114,6 +114,9 @@ func main() { evt.Msg("configuration and env vars info") } + log.Debug().Msgf("Snowplow URL from Service ENV: %s", temp) + log.Debug().Msgf("Snowplow URL computed/from parameter: %s", *snowplowURL) + // Kubernetes configuration var cfg *rest.Config var err error