Skip to content

Conversation

@BeeJay28
Copy link
Contributor

Fixes #7083

Modifies parser to fix case of assuming a site-block + 2 arguments being an "anonymous block" and thusly invalid.
It also slightly streamlines indivisual steps by getting all remaining block-arguments at once.

Tests for both failure and success cases are also added.

@CLAassistant
Copy link

CLAassistant commented Aug 20, 2025

CLA assistant check
All committers have signed the CLA.

@francislavoie
Copy link
Member

Nice, thanks! Could you add some adapt tests to https://github.com/caddyserver/caddy/tree/master/caddytest/integration/caddyfile_adapt as well, to assert that the JSON output is as expected?

@BeeJay28
Copy link
Contributor Author

Nice, thanks! Could you add some adapt tests to master/caddytest/integration/caddyfile_adapt as well, to assert that the JSON output is as expected?

Done! I just took what the current snapshpt looks like via caddy adapt --pretty as the "correct" case. Since I still am a bit new to caddy, I did not fully think or wrap my head around possible edge-cases. If you can think of some and describe them, I can add them too. But for now, the two cases I had already unit-tested are implemented

Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks for working on this.

@francislavoie
Copy link
Member

There's another related issue with {block} if you'd like to look into it, having to do with allowing input tokens to be optional when using a block #6821

@BeeJay28
Copy link
Contributor Author

There's another related issue with {block} if you'd like to look into it, having to do with allowing input tokens to be optional when using a block #6821

Sure, I'd like to try my hand on it

@francislavoie francislavoie added this to the v2.10.2 milestone Aug 22, 2025
@francislavoie francislavoie added the bug 🐞 Something isn't working label Aug 22, 2025
@francislavoie francislavoie changed the title Add 'RemainingArgsAsTokens' function + test to dispenser caddyfile: Fix importing nested tokens for {block} Aug 22, 2025
@francislavoie francislavoie enabled auto-merge (squash) August 22, 2025 21:24
@francislavoie francislavoie merged commit 551f793 into caddyserver:master Aug 22, 2025
23 checks passed
mohammed90 pushed a commit to cedricziel/caddy that referenced this pull request Aug 29, 2025
@elee1766
Copy link
Contributor

elee1766 commented Sep 9, 2025

@BeeJay28 happy to review any pr for #6821 if you do it.

@BeeJay28
Copy link
Contributor Author

BeeJay28 commented Sep 12, 2025

@BeeJay28 happy to review any pr for #6821 if you do it.

The PR is already up since a short while. I just didn't mention it here anymore, since it didn't seem that important overall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

anonymous blocks are not supported when importing site-level snippet with block

4 participants