feat: add save method that will re-unmarshal into the config struct
This commit is contained in:
parent
10060f0245
commit
ef25887a87
|
@ -117,6 +117,20 @@ func (m *Manager) Viper() *viper.Viper {
|
|||
return m.viper
|
||||
}
|
||||
|
||||
func (m *Manager) Save() error {
|
||||
err := m.viper.WriteConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = m.viper.Unmarshal(&m.root)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func newConfig(logger *zap.Logger) (*viper.Viper, error) {
|
||||
if logger == nil {
|
||||
logger = _logger.NewFallbackLogger()
|
||||
|
|
Loading…
Reference in New Issue