-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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: allow modules to customize listener wrappers #3397
httpcaddyfile: allow modules to customize listener wrappers #3397
Conversation
@mholt here's my attempt at allowing modules to add listener wrappers. I'm gonna to carry on with writing tests tomorrow - bit late in the UK :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good for a first contribution!
Just a few personal preferences about line breaks is my only nit. :)
One thing to be careful of: listener wrappers apply at the server level. They don't translate well from Caddyfiles because Caddyfile server blocks are typically (but not always) scoped by a particular host and maybe even request path (and may even span multiple servers/listeners!), but listener wrappers happen at the layer underneath.
So a directive in one server block that adds a listener wrapper may also end up adding it for the other server blocks.
This should probably be reconciled either in the documentation for those directives or the Caddyfile adapter should make sure that duplicates aren't unintentionally added if a user adds a listener wrapper directive to multiple site blocks that actually are on the same listener. The problem of course is that it's almost impossible to tell which might be duplicates, implicitly...
Thoughts?
(Other than that, I'd be willing to merge this already.)
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. LGTM.
I can merge this when you're ready. On the side, I'd still be interested in your take on how to handle the unintuitiveness I described above. Do you think it will be confusing? (We already have this problem with things like the tls
directive, and it's manageable with decent error messages, but we still get a fair number of questions on the forum.)
@disintegrator Anything else on this? Any thoughts ^ ? |
@disintegrator Do you still need this? I don't want to add code to the core that is unneeded... |
All good for now @mholt. I'll close this PR until I'm able to resume the work. |
sorry for my absence :/ |
No worries -- and no need to close this, in fact I'm going to reopen it if that's OK. To clarify: I just wanted to make sure this PR does indeed do what you need. If so, I'll merge it -- if any further review is required though, I can hold off. |
This changes grants modules the ability to customize the listener wrapppers by introducing a new server block pile called listener_wrappers.
For example directives can now return
ConfigValue
s like so:Closes #3394