-
-
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
Get placeholder array from index #5202
Comments
I've thought about implementing something like this before, but I couldn't think of a good way to do it. It happens here in the codebase if you'd like to take a look: https://github.com/caddyserver/caddy/blob/master/caddyconfig/caddyfile/parse.go#L345-L352 (And further down, it does ReplaceKnown to actually replace stuff.) As for the syntax... I think using Could be something like I guess one way it could be implemented is by filling the replacer with a |
Sounds easy enough to add, I'm all for it! I can implement it and make a PR if you'd like. |
@davidpanic Can you build caddy with 5249? |
After looking at this more, I'm wondering if we could keep the So, |
To elaborate on that, I think we can keep the old We can mark the old syntax as deprecated with a Caddyfile adapt warning maybe. But we could defer writing the warning until a later release to not be too annoying. |
I would like to be able to get placeholder values like some programming languages allow to with "rest" arguments. Perhaps it's best explained with an example:
As you can see there's a different amount of arguments (in this case upstream URLs) defined in the import and I want to just specify them all for the reverse proxy upstreams.
To my knowledge there is currently no way to do this, you must specify the arguments by index which doesn't work for variable length arguments.
The text was updated successfully, but these errors were encountered: