mirror of
https://github.com/caddyserver/caddy.git
synced 2026-02-09 01:59:21 +08: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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user