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

Method loadModulesFromRegularMap

context.go:318–331  ·  view source on GitHub ↗

loadModulesFromRegularMap loads modules from val, where val is a map[string]json.RawMessage. Map keys are NOT interpreted as module names, so module names are still expected to appear inline with the objects.

(namespace, inlineModuleKey string, val reflect.Value)

Source from the content-addressed store, hash-verified

316// Map keys are NOT interpreted as module names, so module names are still expected to appear
317// inline with the objects.
318func (ctx Context) loadModulesFromRegularMap(namespace, inlineModuleKey string, val reflect.Value) (map[string]any, error) {
319 mods := make(map[string]any)
320 iter := val.MapRange()
321 for iter.Next() {
322 k := iter.Key()
323 v := iter.Value()
324 mod, err := ctx.loadModuleInline(inlineModuleKey, namespace, v.Interface().(json.RawMessage))
325 if err != nil {
326 return nil, fmt.Errorf("key %s: %v", k, err)
327 }
328 mods[k.String()] = mod
329 }
330 return mods, nil
331}
332
333// loadModuleMap loads modules from a ModuleMap, i.e. map[string]any, where the key is the
334// module name. With a module map, module names do not need to be defined inline with their values.

Callers 1

Calls 4

loadModuleInlineMethod · 0.95
NextMethod · 0.65
ValueMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected