move implementations to external repos (#17)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -6,9 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/unistack-org/micro/v3/config/loader"
|
||||
"github.com/unistack-org/micro/v3/config/loader/memory"
|
||||
"github.com/unistack-org/micro/v3/config/reader"
|
||||
"github.com/unistack-org/micro/v3/config/reader/json"
|
||||
"github.com/unistack-org/micro/v3/config/source"
|
||||
)
|
||||
|
||||
@@ -42,19 +40,12 @@ func newConfig(opts ...Option) (Config, error) {
|
||||
}
|
||||
|
||||
func (c *config) Init(opts ...Option) error {
|
||||
c.opts = Options{
|
||||
Reader: json.NewReader(),
|
||||
}
|
||||
c.opts = Options{}
|
||||
c.exit = make(chan bool)
|
||||
for _, o := range opts {
|
||||
o(&c.opts)
|
||||
}
|
||||
|
||||
// default loader uses the configured reader
|
||||
if c.opts.Loader == nil {
|
||||
c.opts.Loader = memory.NewLoader(memory.WithReader(c.opts.Reader))
|
||||
}
|
||||
|
||||
err := c.opts.Loader.Load(c.opts.Source...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user