Stripping underscores makes viper unable to find env vars #1009
Labels
kind/support
Support requests for using the project
resolution/duplicate
This issue or pull request already exists
Am I going mad, or is there definitely a problem when stripping the _ from env names? I want to make it so that you can configure my app with either env, config file, or flags. And then use viper.Unmarshal() to write the values into my config object. But stripping the underscores from env keys makes viper miss them completely.
In the following test I would expect to get either ":9090" or ":9091" (which is not important at the moment) but no value is found at all. It would appear that the key replacer is being run before the prefix is being stripped and checked, and so it can no longer be found and the keys are rejected.
The text was updated successfully, but these errors were encountered: