frostfs-node/cmd/frostfs-node/config/opts.go
Anton Nikiforov b2123bfd1a [#125] node: Add new option WithEnvPrefix
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2023-04-26 13:53:51 +03:00

38 lines
795 B
Go

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
}
}