diff options
author | Matthew Holt <[email protected]> | 2020-03-06 23:24:09 -0700 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2020-03-06 23:26:13 -0700 |
commit | b216d285dfe8784796d3f6597545c59aa4bec279 (patch) | |
tree | 92a949a75c1460b0aabac97c7d2831222d91a460 /context.go | |
parent | 3f5d27cd5da8f3ad53e4b794d34703922c9b824e (diff) | |
parent | b8cba62643abf849411856bd92c42b59b98779f4 (diff) | |
download | caddy-b216d285dfe8784796d3f6597545c59aa4bec279.tar.gz caddy-b216d285dfe8784796d3f6597545c59aa4bec279.zip |
Merge branch 'certmagic-refactor' into v2
Diffstat (limited to 'context.go')
-rw-r--r-- | context.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/context.go b/context.go index 68d31dabd..9eb677bf8 100644 --- a/context.go +++ b/context.go @@ -21,7 +21,7 @@ import ( "log" "reflect" - "github.com/mholt/certmagic" + "github.com/caddyserver/certmagic" "go.uber.org/zap" ) @@ -384,9 +384,13 @@ func (ctx Context) App(name string) (interface{}, error) { if app, ok := ctx.cfg.apps[name]; ok { return app, nil } - modVal, err := ctx.LoadModuleByID(name, nil) + appRaw := ctx.cfg.AppsRaw[name] + modVal, err := ctx.LoadModuleByID(name, appRaw) if err != nil { - return nil, fmt.Errorf("instantiating new module %s: %v", name, err) + return nil, fmt.Errorf("loading %s app module: %v", name, err) + } + if appRaw != nil { + ctx.cfg.AppsRaw[name] = nil // allow GC to deallocate } ctx.cfg.apps[name] = modVal.(App) return modVal, nil |