From b8cba62643abf849411856bd92c42b59b98779f4 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 6 Mar 2020 23:15:25 -0700 Subject: Refactor for CertMagic v0.10; prepare for PKI app This is a breaking change primarily in two areas: - Storage paths for certificates have changed - Slight changes to JSON config parameters Huge improvements in this commit, to be detailed more in the release notes. The upcoming PKI app will be powered by Smallstep libraries. --- context.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'context.go') diff --git a/context.go b/context.go index d64880c..fc15eca 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 -- cgit v1.2.3