From 6b1ed63b483e516f6af5641e9eb74d6f8efe1cd6 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 20 Dec 2020 01:00:45 +0300 Subject: [PATCH] guard agains not fully configured config sources Signed-off-by: Vasiliy Tolstov --- service.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/service.go b/service.go index 3d2242eb..67e95538 100644 --- a/service.go +++ b/service.go @@ -41,7 +41,10 @@ func (s *service) Init(opts ...Option) error { } for _, cfg := range s.opts.Configs { - + if cfg.Options().Struct == nil { + // skip config as the struct not passed + continue + } if err := cfg.Init(config.Context(s.opts.Context)); err != nil { return err } @@ -161,6 +164,11 @@ func (s *service) Start() error { } for _, cfg := range s.opts.Configs { + if cfg.Options().Struct == nil { + // skip config as the struct not passed + continue + } + if err := cfg.Load(s.opts.Context); err != nil { return err }