From 5859cd8dad32fdd7ea55daa5e4377e273fb97a3e Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 29 Apr 2019 09:22:00 -0600 Subject: Instantiate apps that are needed but not explicitly configured --- modules.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules.go') diff --git a/modules.go b/modules.go index 5a4e69f..6afa6fb 100644 --- a/modules.go +++ b/modules.go @@ -171,9 +171,12 @@ func LoadModule(name string, rawMsg json.RawMessage) (interface{}, error) { val = reflect.New(rv.Type()).Elem().Addr().Interface() } - err = json.Unmarshal(rawMsg, &val) - if err != nil { - return nil, fmt.Errorf("decoding module config: %s: %v", mod.Name, err) + // fill in its config only if there is a config to fill in + if len(rawMsg) > 0 { + err = json.Unmarshal(rawMsg, &val) + if err != nil { + return nil, fmt.Errorf("decoding module config: %s: %v", mod.Name, err) + } } if prov, ok := val.(Provisioner); ok { -- cgit v1.2.3