mirror of
https://github.com/caddyserver/caddy.git
synced 2025-08-06 18:49:59 +08:00
core: Save app provisioning errors with context (#7070)
* fix(provisioning): remove app from apps map when its provision failed * Clean up failed app provisioning with defer * fix(provisioning): record apps that failed to provision with their error * save the error when an app fails to initialize and return this error when this app is requested by a module --------- Co-authored-by: Matt Holt <mholt@users.noreply.github.com> Co-authored-by: WeidiDeng <weidi_deng@icloud.com>
This commit is contained in:

committed by
GitHub

parent
b7ae39e906
commit
fe41ff3c5b
6
caddy.go
6
caddy.go
@ -81,7 +81,10 @@ type Config struct {
|
||||
// associated value.
|
||||
AppsRaw ModuleMap `json:"apps,omitempty" caddy:"namespace="`
|
||||
|
||||
apps map[string]App
|
||||
apps map[string]App
|
||||
|
||||
// failedApps is a map of apps that failed to provision with their underlying error.
|
||||
failedApps map[string]error
|
||||
storage certmagic.Storage
|
||||
eventEmitter eventEmitter
|
||||
|
||||
@ -522,6 +525,7 @@ func provisionContext(newCfg *Config, replaceAdminServer bool) (Context, error)
|
||||
|
||||
// prepare the new config for use
|
||||
newCfg.apps = make(map[string]App)
|
||||
newCfg.failedApps = make(map[string]error)
|
||||
|
||||
// set up global storage and make it CertMagic's default storage, too
|
||||
err = func() error {
|
||||
|
Reference in New Issue
Block a user