persist config digest on caddy instance #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is related to coredns/coredns#6243 and coredns/coredns#6263, and prerequisite for coredns/coredns#6244.
What does this PR do:
caddy.Instance
with a new fieldConfigDigest
, and populate this with a digest of the parsed configuration content (which then includes imported sources); this happens incaddy.ValidateAndExecuteDirectives()
. In addition, a functioncaddy.ConfigDigest()
is added to allow consumers (such as the coredns reload plugin) to calculate that digest value for a givencaddy.Input
.plugin.RegisterOrUpdateEventHook()
which works like the existingplugin.RegisterEventHook()
, but does not panic in case of duplicate registration (instead, just replaces the hook).Note: these two changes are independent from each other, but both are required for the mentioned PR coredns/coredns#6244.