caddy/caddyconfig/caddyfile
WeidiDeng 8bc05e598d
caddyfile: Implement variadics for import args placeholders (#5249)
* implement variadic placeholders
imported snippets reflect actual lines in file

* add import directive line number for imported snippets
add tests for parsing

* add realfile field to help debug import cycle detection.

* use file field to reflect import chain

* Switch syntax, deprecate old syntax, refactoring

- Moved the import args handling to a separate file
- Using {args[0:1]} syntax now
- Deprecate {args.*} syntax
- Use a replacer map for better control over the parsing
- Add plenty of warnings when invalid placeholders are detected
- Renaming variables, cleanup comments for readability
- More tests to cover edgecases I could think of
- Minor cleanup to snippet tracking in tokens, drop a redundant boolean field in tokens

---------

Co-authored-by: Francis Lavoie <lavofr@gmail.com>
2023-02-16 17:08:36 -07:00
..
testdata httpcaddyfile: Warn on importing empty file; skip dotfiles (#5320) 2023-01-21 10:22:36 -07:00
adapter.go cmd: make caddy fmt hints more clear (#5378) 2023-02-16 16:34:12 -07:00
dispenser_test.go Make file modes consistent 2022-04-21 15:06:55 -06:00
dispenser.go map: Coerce val to string, fix #4987 2022-09-01 21:15:44 -06:00
formatter_fuzz.go core: Windows service integration (#4790) 2022-07-29 14:06:54 -06:00
formatter_test.go caddyfile: Copy input before parsing (fix #4422) 2021-11-15 14:41:19 -07:00
formatter.go Fix #4169 (correct e6c58fd) 2022-09-15 14:13:58 -06:00
importargs.go caddyfile: Implement variadics for import args placeholders (#5249) 2023-02-16 17:08:36 -07:00
importgraph.go caddyfile: reject cyclic imports (#4022) 2021-04-09 12:06:25 -06:00
lexer_fuzz.go core: Windows service integration (#4790) 2022-07-29 14:06:54 -06:00
lexer_test.go Make file modes consistent 2022-04-21 15:06:55 -06:00
lexer.go caddyfile: Implement variadics for import args placeholders (#5249) 2023-02-16 17:08:36 -07:00
parse_test.go caddyfile: Implement variadics for import args placeholders (#5249) 2023-02-16 17:08:36 -07:00
parse.go caddyfile: Implement variadics for import args placeholders (#5249) 2023-02-16 17:08:36 -07:00