config: add name to each config imp
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
bcd7f6a551
commit
87e1480077
@ -22,6 +22,7 @@ var (
|
||||
|
||||
// Config is an interface abstraction for dynamic configuration
|
||||
type Config interface {
|
||||
Name() string
|
||||
// Init the config
|
||||
Init(opts ...Option) error
|
||||
// Options in the config
|
||||
|
@ -251,6 +251,10 @@ func (c *defaultConfig) String() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
func (c *defaultConfig) Name() string {
|
||||
return c.opts.Name
|
||||
}
|
||||
|
||||
func NewConfig(opts ...Option) Config {
|
||||
options := NewOptions(opts...)
|
||||
if len(options.StructTag) == 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user