aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules.go
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2019-04-29 09:22:00 -0600
committerMatthew Holt <[email protected]>2019-04-29 09:22:00 -0600
commit5859cd8dad32fdd7ea55daa5e4377e273fb97a3e (patch)
tree7237ca3c4c1de7f00ca508306b9ef7e427b5553c /modules.go
parent43961b542b077f99f78d64629348b9300d3cd4a3 (diff)
downloadcaddy-5859cd8dad32fdd7ea55daa5e4377e273fb97a3e.tar.gz
caddy-5859cd8dad32fdd7ea55daa5e4377e273fb97a3e.zip
Instantiate apps that are needed but not explicitly configured
Diffstat (limited to 'modules.go')
-rw-r--r--modules.go9
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 {