MCPcopy
hub / github.com/caddyserver/caddy / loadModuleInline

Method loadModuleInline

context.go:478–490  ·  view source on GitHub ↗

loadModuleInline loads a module from a JSON raw message which decodes to a map[string]any, where one of the object keys is moduleNameKey and the corresponding value is the module name (as a string) which can be found in the given scope. In other words, the module name is declared in-line with the mo

(moduleNameKey, moduleScope string, raw json.RawMessage)

Source from the content-addressed store, hash-verified

476// no custom keys). In other words, the key containing the module name is
477// treated special/separate from all the other keys in the object.
478func (ctx Context) loadModuleInline(moduleNameKey, moduleScope string, raw json.RawMessage) (any, error) {
479 moduleName, raw, err := getModuleNameInline(moduleNameKey, raw)
480 if err != nil {
481 return nil, err
482 }
483
484 val, err := ctx.LoadModuleByID(moduleScope+"."+moduleName, raw)
485 if err != nil {
486 return nil, fmt.Errorf("loading module '%s': %v", moduleName, err)
487 }
488
489 return val, nil
490}
491
492// App returns the configured app named name. If that app has
493// not yet been loaded and provisioned, it will be immediately

Callers 2

LoadModuleMethod · 0.95

Calls 2

LoadModuleByIDMethod · 0.95
getModuleNameInlineFunction · 0.85

Tested by

no test coverage detected