-
-
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
Feature-Request: Placeholder with default value #1793
Comments
Will be mostly irrelevant in Caddy 2, which provides this capability through other means. |
Any updates on this one? |
@yesiyan01 what exactly are you looking for? Could you be more specific? What you want is probably possible another way. |
I have a reverse proxy handler that overrides authorization header e.g.
where 'http.oauth1' is a custom header value set from a custom module. I'd like the ability to use 'http.oauth1' in the placeholder but fallback to a static API-KEY when http.oauth1 is not present. |
Thanks for the example! The changes would need to be made to https://github.com/caddyserver/caddy/blob/master/replacer.go, if you'd like to take a crack at it. We recently implemented defaults for environment variables in the Caddyfile, so I think we should follow suit in this case and use the same syntax, i.e. This change would need to be thoroughly tested (see |
Support variable expansion also in placeholders, like in `{unsetPlaceholder:default value}`. Implemented similarly to caddyserver#3682, which provided defaults for environment variable expansion. Closes caddyserver#1793. Signed-off-by: Jens Erat <[email protected]>
Support variable expansion also in placeholders, like in `{unsetPlaceholder:default value}`. Implemented similarly to caddyserver#3682, which provided defaults for environment variable expansion. Closes caddyserver#1793. Signed-off-by: Jens Erat <[email protected]>
If there is no/empty for a placeholder use default/fallback value/placeholder.
Acceptance Test
Pattern
Expectations
foo
bar
John
Mark
John
John
John
Mark
Mark
Usage example
Other software which uses this pattern
https://logback.qos.ch/manual/configuration.html#defaultValuesForVariables
The text was updated successfully, but these errors were encountered: