Provision sets up the configuration for the PKI app.
(ctx caddy.Context)
| 54 | |
| 55 | // Provision sets up the configuration for the PKI app. |
| 56 | func (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. |
| 81 | func (p *PKI) ProvisionDefaultCA(ctx caddy.Context) error { |
nothing calls this directly
no test coverage detected