summaryrefslogtreecommitdiff
path: root/internal/config/state.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/state.go')
-rw-r--r--internal/config/state.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/config/state.go b/internal/config/state.go
index 70972a835..1364fb84e 100644
--- a/internal/config/state.go
+++ b/internal/config/state.go
@@ -22,6 +22,7 @@ import (
"strings"
"sync"
+ "github.com/mitchellh/mapstructure"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
@@ -129,8 +130,10 @@ func (st *ConfigState) reloadToViper() {
// reloadFromViper will reload Configuration{} values from viper.
func (st *ConfigState) reloadFromViper() {
- err := st.config.UnmarshalMap(st.viper.AllSettings())
- if err != nil {
+ if err := st.viper.Unmarshal(&st.config, func(c *mapstructure.DecoderConfig) {
+ c.TagName = "name"
+ c.ZeroFields = true // empty the config struct before we marshal values into it
+ }); err != nil {
panic(err)
}
}