MCPcopy Create free account
hub / github.com/gotenberg/gotenberg / loadModule

Method loadModule

pkg/gotenberg/context.go:104–124  ·  view source on GitHub ↗

loadModule calls the Provision and/or Validate methods of the requested module if it satisfies the [Provisioner] and/or [Validator] interfaces.

(id string, instance any)

Source from the content-addressed store, hash-verified

102// loadModule calls the Provision and/or Validate methods of the requested
103// module if it satisfies the [Provisioner] and/or [Validator] interfaces.
104func (ctx *Context) loadModule(id string, instance any) error {
105 if prov, ok := instance.(Provisioner); ok {
106 // The instance can be provisioned.
107 err := prov.Provision(ctx)
108 if err != nil {
109 return fmt.Errorf("provision module %s: %w", id, err)
110 }
111 }
112
113 if validator, ok := instance.(Validator); ok {
114 // The instance can be validated.
115 err := validator.Validate()
116 if err != nil {
117 return fmt.Errorf("validate module %s: %w", id, err)
118 }
119 }
120
121 ctx.moduleInstances[id] = instance
122
123 return nil
124}

Callers 2

TestContext_loadModuleFunction · 0.95
ModulesMethod · 0.95

Calls 2

ProvisionMethod · 0.65
ValidateMethod · 0.65

Tested by 1

TestContext_loadModuleFunction · 0.76