Skip to content

fix(caddyfile): Expand imported snippets within named routes at parse time#7446

Open
glossawy wants to merge 3 commits intocaddyserver:masterfrom
glossawy:master
Open

fix(caddyfile): Expand imported snippets within named routes at parse time#7446
glossawy wants to merge 3 commits intocaddyserver:masterfrom
glossawy:master

Conversation

@glossawy
Copy link

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.

@CLAassistant
Copy link

CLAassistant commented Jan 22, 2026

CLA assistant check
All committers have signed the CLA.

@glossawy glossawy marked this pull request as ready for review January 22, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snippets can't be imported in named routes

2 participants