I realized that a SetValue() defined on a custom struct type is never called. Insted, the struct is flattened. This prevents me from parsing e.g., a yaml string from an ENV variable:
type Config struct {
Complex ComplexYamlConfig `env:"COMPLEX_CONFIG"`
}
type ComplexYamlConfig struct {
Left string `yaml:"myProp"`
}
func (c *ComplexYamlConfig) SetValue(s string) error {
// will never be called by cleanenv
return yaml.Unmarshal([]byte(s), c)
}
Is this something that can be added? Or is there a different way of achieving the same thing?
I realized that a
SetValue()
defined on a custom struct type is never called. Insted, the struct is flattened. This prevents me from parsing e.g., a yaml string from an ENV variable:Is this something that can be added? Or is there a different way of achieving the same thing?