From d0c1756fc56dd43cee73ef7ccabb2276a5b26caf Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 13 Sep 2019 09:45:10 -0600 Subject: httpcaddyfile: Fix tls certificate loader module names (#2748) --- modules.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'modules.go') diff --git a/modules.go b/modules.go index ad03adf..3ca5384 100644 --- a/modules.go +++ b/modules.go @@ -126,6 +126,17 @@ func GetModuleName(instance interface{}) string { return name } +// GetModuleID returns a module's ID (the last element of its name) +// from an instance of its value. If the value is not a module, +// an empty string will be returned. +func GetModuleID(instance interface{}) string { + var name string + if mod, ok := instance.(Module); ok { + name = mod.CaddyModule().ID() + } + return name +} + // GetModules returns all modules in the given scope/namespace. // For example, a scope of "foo" returns modules named "foo.bar", // "foo.loo", but not "bar", "foo.bar.loo", etc. An empty scope -- cgit v1.2.3