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

Method Provision

modules/caddypki/pki.go:56–78  ·  view source on GitHub ↗

Provision sets up the configuration for the PKI app.

(ctx caddy.Context)

Source from the content-addressed store, hash-verified

54
55// Provision sets up the configuration for the PKI app.
56func (p *PKI) Provision(ctx caddy.Context) error {
57 p.ctx = ctx
58 p.log = ctx.Logger()
59
60 for caID, ca := range p.CAs {
61 err := ca.Provision(ctx, caID, p.log)
62 if err != nil {
63 return fmt.Errorf("provisioning CA '%s': %v", caID, err)
64 }
65 }
66
67 // if this app is initialized at all, ensure there's at
68 // least a default CA that can be used: the standard CA
69 // which is used implicitly for signing local-use certs
70 if len(p.CAs) == 0 {
71 err := p.ProvisionDefaultCA(ctx)
72 if err != nil {
73 return fmt.Errorf("provisioning CA '%s': %v", DefaultCAID, err)
74 }
75 }
76
77 return nil
78}
79
80// ProvisionDefaultCA sets up the default CA.
81func (p *PKI) ProvisionDefaultCA(ctx caddy.Context) error {

Callers

nothing calls this directly

Calls 3

ProvisionDefaultCAMethod · 0.95
ProvisionMethod · 0.65
LoggerMethod · 0.45

Tested by

no test coverage detected