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
|
// Config is an interface abstraction for dynamic configuration
|
||||||
type Config interface {
|
type Config interface {
|
||||||
|
Name() string
|
||||||
// Init the config
|
// Init the config
|
||||||
Init(opts ...Option) error
|
Init(opts ...Option) error
|
||||||
// Options in the config
|
// Options in the config
|
||||||
|
@ -251,6 +251,10 @@ func (c *defaultConfig) String() string {
|
|||||||
return "default"
|
return "default"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *defaultConfig) Name() string {
|
||||||
|
return c.opts.Name
|
||||||
|
}
|
||||||
|
|
||||||
func NewConfig(opts ...Option) Config {
|
func NewConfig(opts ...Option) Config {
|
||||||
options := NewOptions(opts...)
|
options := NewOptions(opts...)
|
||||||
if len(options.StructTag) == 0 {
|
if len(options.StructTag) == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user