Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpcaddyfile: Add {vars.*} placeholder shortcut, reverse vars sort order #4726

Merged
merged 2 commits into from Apr 25, 2022

Conversation

francislavoie
Copy link
Member

@francislavoie francislavoie commented Apr 24, 2022

I'm yoinking the placeholder from my #4657 PR because I think we should get this in ASAP for v2.5.0 along with the new vars directive.

Also, during testing while writing the docs, I realized we should reverse the vars directive sort order based on matchers; since this is a directive which overwrites existing values set by other previously run directives, we actually want the least-specific matcher to run first, and most-specific last, so that the most-specific is the last one to overwrites the value.

For example, with this config:

vars foo bar
vars /path* foo baz

respond {vars.foo}

Before this change, all requests would return bar, because the least specific matcher would run last, overwriting any more specific matcher. After the change, /path* requests will correctly return baz.

I'm yoinking this from my #4657 PR because I think we should get this in ASAP for v2.5.0 along with the new `vars` directive.
@francislavoie francislavoie added the feature ⚙️ New feature or request label Apr 24, 2022
@francislavoie francislavoie added this to the v2.5.0 milestone Apr 24, 2022
@francislavoie francislavoie changed the title httpcaddyfile: Add {vars.*} placeholder shortcut httpcaddyfile: Add {vars.*} placeholder shortcut, reverse vars sort order Apr 24, 2022
@francislavoie francislavoie added the bug 🐞 Something isn't working label Apr 24, 2022
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Thanks for this. Seems to be a good change, has a test, and is minimally invasive. Will merge this for 2.5.

@mholt mholt merged commit a8bb4a6 into master Apr 25, 2022
@mholt mholt deleted the vars-placeholder-shortcut branch April 25, 2022 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working feature ⚙️ New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants