mirror of
https://github.com/coredns/coredns.git
synced 2026-08-20 23:08:28 -04:00
plugin/tls: manage certificates with ACME DNS-01 (#8310)
* plugin/tls: add automatic ACME certificates Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com> * chore: add houyuwushang to CODEOWNERS Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com> * chore: regenerate maintainer owners Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com> --------- Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
This commit is contained in:
@@ -171,3 +171,22 @@ func GetConfig(c *caddy.Controller) *Config {
|
||||
ctx.saveConfig(key, &Config{ListenHosts: []string{""}})
|
||||
return GetConfig(c)
|
||||
}
|
||||
|
||||
// AddPluginToAllServerBlocks adds m once to every server block in c's
|
||||
// instance. It is intended for directives that must handle traffic on a
|
||||
// listener other than the one where the directive is configured.
|
||||
func AddPluginToAllServerBlocks(c *caddy.Controller, m plugin.Plugin) {
|
||||
ctx := c.Context().(*dnsContext)
|
||||
seen := make(map[*Config]struct{})
|
||||
for _, cfg := range ctx.configs {
|
||||
first := cfg.firstConfigInBlock
|
||||
if first == nil {
|
||||
first = cfg
|
||||
}
|
||||
if _, ok := seen[first]; ok {
|
||||
continue
|
||||
}
|
||||
seen[first] = struct{}{}
|
||||
first.AddPlugin(m)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user