MCPcopy
hub / github.com/spf13/viper / MergeInConfig

Method MergeInConfig

viper.go:1549–1566  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1547func MergeInConfig() error { return v.MergeInConfig() }
1548
1549func (v *Viper) MergeInConfig() error {
1550 v.logger.Info("attempting to merge in config file")
1551 filename, err := v.getConfigFile()
1552 if err != nil {
1553 return err
1554 }
1555
1556 if !slices.Contains(SupportedExts, v.getConfigType()) {
1557 return UnsupportedConfigError(v.getConfigType())
1558 }
1559
1560 file, err := afero.ReadFile(v.fs, filename)
1561 if err != nil {
1562 return err
1563 }
1564
1565 return v.MergeConfig(bytes.NewReader(file))
1566}
1567
1568// ReadConfig will read a configuration file, setting existing keys to nil if the
1569// key does not exist in the file.

Callers 2

MergeInConfigFunction · 0.80

Calls 4

getConfigFileMethod · 0.95
getConfigTypeMethod · 0.95
MergeConfigMethod · 0.95
UnsupportedConfigErrorTypeAlias · 0.85

Tested by 1