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 <smarkin@mirantis.com>
This commit is contained in:
Sergiy Markin
2025-07-28 21:24:41 +00:00
parent 400edcc57e
commit 9ff5d2e488

View File

@@ -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",