From aef6878ee0416b91b121aee789d697e897914524 Mon Sep 17 00:00:00 2001 From: Colin Hoglund Date: Fri, 19 Jun 2020 03:49:30 -0400 Subject: [PATCH] config: use configured reader by default (#1717) --- config/default.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/default.go b/config/default.go index a774469f..34a14c14 100644 --- a/config/default.go +++ b/config/default.go @@ -41,7 +41,6 @@ func newConfig(opts ...Option) (Config, error) { func (c *config) Init(opts ...Option) error { c.opts = Options{ - Loader: memory.NewLoader(), Reader: json.NewReader(), } c.exit = make(chan bool) @@ -49,6 +48,11 @@ func (c *config) Init(opts ...Option) error { 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