mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 15:53:17 +00:00
Instantiate apps that are needed but not explicitly configured
This commit is contained in:
parent
43961b542b
commit
5859cd8dad
4 changed files with 44 additions and 19 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue