mirror of
https://github.com/coredns/coredns.git
synced 2026-10-26 12:15:50 -04:00
plugin/reload: hash the configuration executed by each instance (#8642)
Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package dnsserver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha512"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@@ -211,6 +212,13 @@ func GetConfig(c *caddy.Controller) *Config {
|
||||
return GetConfig(c)
|
||||
}
|
||||
|
||||
// GetConfigHash returns the SHA512 hash of the parsed configuration for c's
|
||||
// instance, including all server blocks and expanded imports. It is captured
|
||||
// before server block normalization and plugin setup, without re-reading files.
|
||||
func GetConfigHash(c *caddy.Controller) [sha512.Size]byte {
|
||||
return c.Context().(*dnsContext).configHash
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
||||
Reference in New Issue
Block a user