frostfs-node/cmd/internal/common/config/opts.go

39 lines
795 B
Go
Raw Normal View History

package config
type Opts struct {
Path string
ConfigDir string
EnvPrefix string
}
func DefaultOpts() *Opts {
return new(Opts)
}
// Option allows to set an optional parameter of the Config.
type Option func(*Opts)
// WithConfigFile returns an option to set the system path
// to the configuration file.
func WithConfigFile(path string) Option {
return func(o *Opts) {
o.Path = path
}
}
// WithConfigDir returns an option to set the system path
// to the directory with configuration files.
func WithConfigDir(path string) Option {
return func(o *Opts) {
o.ConfigDir = path
}
}
// WithEnvPrefix returns an option to defines
// a prefix that ENVIRONMENT variables will use.
func WithEnvPrefix(envPrefix string) Option {
return func(o *Opts) {
o.EnvPrefix = envPrefix
}
}