mirror of
https://github.com/spf13/viper
synced 2024-12-22 11:37:02 +00:00
feat: add experimental finder option
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
db0bbd8f97
commit
2636060878
2 changed files with 9 additions and 0 deletions
|
@ -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.
|
// Finder looks for files and directories in an [afero.Fs] filesystem.
|
||||||
type Finder interface {
|
type Finder interface {
|
||||||
Find(fsys afero.Fs) ([]string, error)
|
Find(fsys afero.Fs) ([]string, error)
|
||||||
|
|
2
viper.go
2
viper.go
|
@ -194,6 +194,8 @@ type Viper struct {
|
||||||
// TODO: should probably be protected with a mutex
|
// TODO: should probably be protected with a mutex
|
||||||
encoderRegistry *encoding.EncoderRegistry
|
encoderRegistry *encoding.EncoderRegistry
|
||||||
decoderRegistry *encoding.DecoderRegistry
|
decoderRegistry *encoding.DecoderRegistry
|
||||||
|
|
||||||
|
experimentalFinder bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns an initialized Viper instance.
|
// New returns an initialized Viper instance.
|
||||||
|
|
Loading…
Reference in a new issue