mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 15:53:17 +00:00
context: Rename func to AppIfConfigured
(#5397)
This commit is contained in:
parent
941eae5f61
commit
f6bab8ba85
2 changed files with 17 additions and 18 deletions
|
@ -49,20 +49,14 @@ 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)
|
||||
|
||||
// First check if the PKI app was configured, because
|
||||
// a.ctx.App() has the side effect of instantiating
|
||||
// and provisioning an app even if it wasn't configured.
|
||||
pkiAppConfigured := a.ctx.AppIsConfigured("pki")
|
||||
if !pkiAppConfigured {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Load the PKI app, so we can query it for information.
|
||||
appModule, err := a.ctx.App("pki")
|
||||
// Avoid initializing PKI if it wasn't configured
|
||||
pkiApp, err := a.ctx.AppIfConfigured("pki")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
a.pkiApp = appModule.(*PKI)
|
||||
if pkiApp != nil {
|
||||
a.pkiApp = pkiApp.(*PKI)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue