From 9ff5d2e488ad18187bccc48e9595f197d27110c4 Mon Sep 17 00:00:00 2001 From: Sergiy Markin Date: Mon, 28 Jul 2025 21:24:41 +0000 Subject: [PATCH] Fix unable to unmarshall env variable This commit fixes an issue where the environment variable `DEPENDENCY_CUSTOM_RESOURCE` was not being unmarshalled correctly from the custom resource. Change-Id: I94eb3b721a4022e47e228261bf9a9eff99bfb0f4 Signed-off-by: Sergiy Markin --- dependencies/customresource/customresource.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dependencies/customresource/customresource.go b/dependencies/customresource/customresource.go index 13518b2..08aa85d 100644 --- a/dependencies/customresource/customresource.go +++ b/dependencies/customresource/customresource.go @@ -78,6 +78,11 @@ func fromEnv(jsonEnv string) ([]Resolver, error) { return resolvers, nil } + // Check if the environment variable is empty + if strings.TrimSpace(jsonEnvVal) == "" { + return resolvers, nil + } + err := json.Unmarshal([]byte(jsonEnvVal), &resolvers) if err != nil { return resolvers, fmt.Errorf("unable to unmarshal variable %s with value %s: %s",