mirror of
https://github.com/caddyserver/website.git
synced 2025-04-21 20:46:15 -04:00
docs: Import arguments (#162)
* Added documentation for snippet arguments Added documentation, the only resource available for this feature, a post on the forum and the PR : https://github.com/caddyserver/caddy/pull/3423 * Update src/docs/markdown/caddyfile/concepts.md Co-authored-by: Matt Holt <mholt@users.noreply.github.com> * Update src/docs/markdown/caddyfile/concepts.md Co-authored-by: Matt Holt <mholt@users.noreply.github.com> * Change for more generic example Co-authored-by: Matt Holt <mholt@users.noreply.github.com> Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
parent
a1bc26c553
commit
25742214dc
1 changed files with 15 additions and 0 deletions
|
@ -276,6 +276,21 @@ import redirect
|
||||||
|
|
||||||
The [`import`](/docs/caddyfile/directives/import) directive can also be used to include other files in its place. As a special case, it can appear almost anywhere within the Caddyfile.
|
The [`import`](/docs/caddyfile/directives/import) directive can also be used to include other files in its place. As a special case, it can appear almost anywhere within the Caddyfile.
|
||||||
|
|
||||||
|
You can pass arguments to imported configuration and use them like so:
|
||||||
|
|
||||||
|
```caddy
|
||||||
|
(snippet) {
|
||||||
|
respond "Yahaha! You found {args.0}!"
|
||||||
|
}
|
||||||
|
|
||||||
|
a.example.com {
|
||||||
|
import snippet "Example A"
|
||||||
|
}
|
||||||
|
|
||||||
|
b.example.com {
|
||||||
|
import snippet "Example B"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Comments
|
## Comments
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue