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:
@@ -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",
|
||||
|
Reference in New Issue
Block a user