mirror of
https://github.com/caddyserver/caddy.git
synced 2025-12-08 06:09:53 +00:00
context: AppIfConfigured returns error; consider not-yet-provisioned modules (#6292)
* context: Add new `AppStrict()` method to avoid instantiating empty apps * Rename AppStrict -> AppIfConfigured --------- Co-authored-by: Matthew Holt <mholt@users.noreply.github.com>
This commit is contained in:
parent
73e094e1dd
commit
a6a45ff6c5
4 changed files with 25 additions and 25 deletions
|
|
@ -50,8 +50,11 @@ func (a *adminAPI) Provision(ctx caddy.Context) error {
|
|||
a.ctx = ctx
|
||||
a.log = ctx.Logger(a) // TODO: passing in 'a' is a hack until the admin API is officially extensible (see #5032)
|
||||
|
||||
// Avoid initializing PKI if it wasn't configured
|
||||
if pkiApp := a.ctx.AppIfConfigured("pki"); pkiApp != nil {
|
||||
// Avoid initializing PKI if it wasn't configured.
|
||||
// We intentionally ignore the error since it's not
|
||||
// fatal if the PKI app is not explicitly configured.
|
||||
pkiApp, err := ctx.AppIfConfigured("pki")
|
||||
if err == nil {
|
||||
a.pkiApp = pkiApp.(*PKI)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue