b8a5f09174
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
34 lines
688 B
Go
34 lines
688 B
Go
package configtest
|
|
|
|
import "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
|
|
|
func fromFile(path string) *config.Config {
|
|
var p config.Prm
|
|
|
|
return config.New(p,
|
|
config.WithConfigFile(path),
|
|
)
|
|
}
|
|
|
|
func forEachFile(paths []string, f func(*config.Config)) {
|
|
for i := range paths {
|
|
f(fromFile(paths[i]))
|
|
}
|
|
}
|
|
|
|
// ForEachFileType passes configs read from next files:
|
|
// - `<pref>.yaml`;
|
|
// - `<pref>.json`.
|
|
func ForEachFileType(pref string, f func(*config.Config)) {
|
|
forEachFile([]string{
|
|
pref + ".yaml",
|
|
pref + ".json",
|
|
}, f)
|
|
}
|
|
|
|
// EmptyConfig returns config without any values and sections.
|
|
func EmptyConfig() *config.Config {
|
|
var p config.Prm
|
|
|
|
return config.New(p)
|
|
}
|