fix(caddyfile): Expand imported snippets within named routes at parse time#7446
Open
glossawy wants to merge 3 commits intocaddyserver:masterfrom
Open
fix(caddyfile): Expand imported snippets within named routes at parse time#7446glossawy wants to merge 3 commits intocaddyserver:masterfrom
glossawy wants to merge 3 commits intocaddyserver:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #6431
Handles imports and any other potential current or future parse-time constructs by taking block tokens for a named route block and running those tokens through the entire parsing system itself, like a nested caddyfile with any context, defined snippets, and metadata inherited from its "parent" parser.
The proposal here is just to create a new "child" parser with the necessary cloned data, parsing the named route block with that parser, and then yielding back the resulting parsed tokens and any necessary changes to e.g. the import graph.
This way any changes to the parsing in general will apply to named routes as well and otherwise leaves the interpretation of tokens after parsing the same since the structure for named routes remains the same as before: a normal server block with a known
invoke-able name.Assistance Disclosure
No AI tools were used to produce the changes in this pull request.