Provision sets up the issuer.
(ctx caddy.Context)
| 66 | |
| 67 | // Provision sets up the issuer. |
| 68 | func (iss *InternalIssuer) Provision(ctx caddy.Context) error { |
| 69 | iss.logger = ctx.Logger() |
| 70 | |
| 71 | // set some defaults |
| 72 | if iss.CA == "" { |
| 73 | iss.CA = caddypki.DefaultCAID |
| 74 | } |
| 75 | |
| 76 | // get a reference to the configured CA |
| 77 | appModule, err := ctx.App("pki") |
| 78 | if err != nil { |
| 79 | return err |
| 80 | } |
| 81 | pkiApp := appModule.(*caddypki.PKI) |
| 82 | ca, err := pkiApp.GetCA(ctx, iss.CA) |
| 83 | if err != nil { |
| 84 | return err |
| 85 | } |
| 86 | iss.ca = ca |
| 87 | |
| 88 | // set any other default values |
| 89 | if iss.Lifetime == 0 { |
| 90 | iss.Lifetime = caddy.Duration(defaultInternalCertLifetime) |
| 91 | } |
| 92 | |
| 93 | return nil |
| 94 | } |
| 95 | |
| 96 | // IssuerKey returns the unique issuer key for the |
| 97 | // configured CA endpoint. |