feat: add experimental finder option

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2024-06-04 15:16:57 +02:00 committed by Márk Sági-Kazár
parent db0bbd8f97
commit 2636060878
2 changed files with 9 additions and 0 deletions

View file

@ -13,6 +13,13 @@ func WithFinder(f Finder) Option {
})
}
// ExperimentalFinder tells Viper to use the new Finder interface for finding configuration files.
func ExperimentalFinder() Option {
return optionFunc(func(v *Viper) {
v.experimentalFinder = true
})
}
// Finder looks for files and directories in an [afero.Fs] filesystem.
type Finder interface {
Find(fsys afero.Fs) ([]string, error)

View file

@ -194,6 +194,8 @@ type Viper struct {
// TODO: should probably be protected with a mutex
encoderRegistry *encoding.EncoderRegistry
decoderRegistry *encoding.DecoderRegistry
experimentalFinder bool
}
// New returns an initialized Viper instance.