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

Method AddConfigPath

viper.go:460–473  ·  view source on GitHub ↗
(in string)

Source from the content-addressed store, hash-verified

458func AddConfigPath(in string) { v.AddConfigPath(in) }
459
460func (v *Viper) AddConfigPath(in string) {
461 if v.finder != nil {
462 v.logger.Warn("ineffective call to function: custom finder takes precedence", slog.String("function", "AddConfigPath"))
463 }
464
465 if in != "" {
466 absin := absPathify(v.logger, in)
467
468 v.logger.Info("adding path to search paths", "path", absin)
469 if !slices.Contains(v.configPaths, absin) {
470 v.configPaths = append(v.configPaths, absin)
471 }
472 }
473}
474
475// searchMap recursively searches for a value for path in source map.
476// Returns nil if not found.

Callers 9

TestGetConfigFileFunction · 0.80
TestReadInConfigFunction · 0.80
TestDirsSearchFunction · 0.80
TestSafeWriteConfigFunction · 0.80
TestWriteHiddenFileFunction · 0.80
AddConfigPathFunction · 0.80

Calls 2

absPathifyFunction · 0.85
StringMethod · 0.80

Tested by 8

TestGetConfigFileFunction · 0.64
TestReadInConfigFunction · 0.64
TestDirsSearchFunction · 0.64
TestSafeWriteConfigFunction · 0.64
TestWriteHiddenFileFunction · 0.64