cleanenv
cleanenv copied to clipboard
Custom functions are not running for values from files
I've noticed that when reading a config file with a field that is not available in env, its custom function won't run.
The reason seems to be that for these kind of fields, parseValue
won't be called and therefore the corresponding custom function.
Custom functions runs only if the field was provided as an env argument or with a zero'ed value:
- https://github.com/ilyakaznacheev/cleanenv/blob/ce3ee7fb74f018e1dc0f302520bba3c44ce2f786/cleanenv.go#L309
- https://github.com/ilyakaznacheev/cleanenv/blob/ce3ee7fb74f018e1dc0f302520bba3c44ce2f786/cleanenv.go#L321
Thanks, marked to be fixed.
Feel free to send a PR with a fix if you have ideas on how to fix that! I had huge issues with free time last months, so not sure when I will fix that by myself.
👋🏻 @ilyakaznacheev I would love to take a look at this. Could you assign this to me? Thanks!
@pansachin sure, thanks