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

Method UnmarshalCaddyfile

modules/caddytls/capools.go:185–200  ·  modules/caddytls/capools.go::FileCAPool.UnmarshalCaddyfile

Syntax: trust_pool file [<pem_file>...] { pem_file <pem_file>... } The 'pem_file' directive can be specified multiple times.

(d *caddyfile.Dispenser)

Source from the content-addressed store, hash-verified

183//
184// The 'pem_file' directive can be specified multiple times.
185func (fcap *FileCAPool) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
186 d.Next() // consume module name
187 fcap.TrustedCACertPEMFiles = append(fcap.TrustedCACertPEMFiles, d.RemainingArgs()...)
188 for d.NextBlock(0) {
189 switch d.Val() {
190 case "pem_file":
191 fcap.TrustedCACertPEMFiles = append(fcap.TrustedCACertPEMFiles, d.RemainingArgs()...)
192 default:
193 return d.Errf("unrecognized directive: %s", d.Val())
194 }
195 }
196 if len(fcap.TrustedCACertPEMFiles) == 0 {
197 return d.Err("no certificates specified")
198 }
199 return nil
200}
201
202func (f FileCAPool) CertPool() *x509.CertPool {
203 return f.pool

Callers 1

Calls 6

RemainingArgsMethod · 0.80
NextBlockMethod · 0.80
ValMethod · 0.80
ErrfMethod · 0.80
ErrMethod · 0.80
NextMethod · 0.65

Tested by 1