diff options
author | Matthew Holt <[email protected]> | 2019-04-29 09:22:00 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2019-04-29 09:22:00 -0600 |
commit | 5859cd8dad32fdd7ea55daa5e4377e273fb97a3e (patch) | |
tree | 7237ca3c4c1de7f00ca508306b9ef7e427b5553c /modules.go | |
parent | 43961b542b077f99f78d64629348b9300d3cd4a3 (diff) | |
download | caddy-5859cd8dad32fdd7ea55daa5e4377e273fb97a3e.tar.gz caddy-5859cd8dad32fdd7ea55daa5e4377e273fb97a3e.zip |
Instantiate apps that are needed but not explicitly configured
Diffstat (limited to 'modules.go')
-rw-r--r-- | modules.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/modules.go b/modules.go index 5a4e69fc0..6afa6fb9f 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 { |