aboutsummaryrefslogtreecommitdiffhomepage
path: root/context.go
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2020-03-06 23:15:25 -0700
committerMatthew Holt <[email protected]>2020-03-06 23:15:25 -0700
commitb8cba62643abf849411856bd92c42b59b98779f4 (patch)
tree518ddc4db0ce065353fd6f499c8eaf2975b65d13 /context.go
parent7cca291d62c910c0544f0c0169a8f0c81627e5d3 (diff)
downloadcaddy-b8cba62643abf849411856bd92c42b59b98779f4.tar.gz
caddy-b8cba62643abf849411856bd92c42b59b98779f4.zip
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.
Diffstat (limited to 'context.go')
-rw-r--r--context.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/context.go b/context.go
index d64880c14..fc15eca1e 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