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

Method UnmarshalCaddyfile

modules/caddytls/capools.go:465–495  ·  view source on GitHub ↗

Syntax: trust_pool storage [<storage_keys>...] { storage <storage_module> keys <storage_keys>... } The 'keys' directive can be specified multiple times. The'storage' directive is optional and defaults to the default storage module.

(d *caddyfile.Dispenser)

Source from the content-addressed store, hash-verified

463// The 'keys' directive can be specified multiple times.
464// The'storage' directive is optional and defaults to the default storage module.
465func (sp *StoragePool) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
466 d.Next() // consume module name
467 sp.PEMKeys = append(sp.PEMKeys, d.RemainingArgs()...)
468 for nesting := d.Nesting(); d.NextBlock(nesting); {
469 switch d.Val() {
470 case "storage":
471 if sp.StorageRaw != nil {
472 return d.Err("storage module already set")
473 }
474 if !d.NextArg() {
475 return d.ArgErr()
476 }
477 modStem := d.Val()
478 modID := "caddy.storage." + modStem
479 unm, err := caddyfile.UnmarshalModule(d, modID)
480 if err != nil {
481 return err
482 }
483 storage, ok := unm.(caddy.StorageConverter)
484 if !ok {
485 return d.Errf("module %s is not a caddy.StorageConverter", modID)
486 }
487 sp.StorageRaw = caddyconfig.JSONModuleObject(storage, "module", modStem, nil)
488 case "keys":
489 sp.PEMKeys = append(sp.PEMKeys, d.RemainingArgs()...)
490 default:
491 return d.Errf("unrecognized directive: %s", d.Val())
492 }
493 }
494 return nil
495}
496
497func (p StoragePool) CertPool() *x509.CertPool {
498 return p.pool

Callers 1

Calls 11

UnmarshalModuleFunction · 0.92
JSONModuleObjectFunction · 0.92
RemainingArgsMethod · 0.80
NestingMethod · 0.80
NextBlockMethod · 0.80
ValMethod · 0.80
ErrMethod · 0.80
NextArgMethod · 0.80
ArgErrMethod · 0.80
ErrfMethod · 0.80
NextMethod · 0.65

Tested by 1