2021-05-21 11:50:40 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
type opts struct {
|
2023-02-06 13:53:16 +00:00
|
|
|
path string
|
|
|
|
configDir string
|
2021-05-21 11:50:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func defaultOpts() *opts {
|
|
|
|
return new(opts)
|
|
|
|
}
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// Option allows to set an optional parameter of the Config.
|
2021-05-21 11:50:40 +00:00
|
|
|
type Option func(*opts)
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// WithConfigFile returns an option to set the system path
|
2021-05-21 11:50:40 +00:00
|
|
|
// to the configuration file.
|
|
|
|
func WithConfigFile(path string) Option {
|
|
|
|
return func(o *opts) {
|
|
|
|
o.path = path
|
|
|
|
}
|
|
|
|
}
|
2023-02-06 13:53:16 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
}
|