forked from spf13/viper
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SetDefaultsFrom to load defaults from a struct
In cases where there isn't a configuration file, none of the fields on the struct are bound to environment variables unless BindEnv was explicitly called. AutomaticEnv essentially doesn't work with the config file per spf13#761. If you need to support this scenario, call SetDefaultsFrom on the destination struct before calling Unmarshal. Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters