summaryrefslogtreecommitdiff
path: root/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'context.go')
-rw-r--r--context.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/context.go b/context.go
index a6386aa..2a6f514 100644
--- a/context.go
+++ b/context.go
@@ -423,6 +423,17 @@ func (ctx Context) App(name string) (interface{}, error) {
return modVal, nil
}
+// AppIsConfigured returns whether an app named name has been
+// configured. Can be called before calling App() to avoid
+// instantiating an empty app when that's not desirable.
+func (ctx Context) AppIsConfigured(name string) bool {
+ if _, ok := ctx.cfg.apps[name]; ok {
+ return true
+ }
+ appRaw := ctx.cfg.AppsRaw[name]
+ return appRaw != nil
+}
+
// Storage returns the configured Caddy storage implementation.
func (ctx Context) Storage() certmagic.Storage {
return ctx.cfg.storage