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
This commit is contained in:
Arthur T 2021-05-07 21:16:53 +02:00 committed by GitHub
parent a223b5ed55
commit 47b97b8262
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -276,6 +276,27 @@ 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.
The [`import`](/docs/caddyfile/directives/import) directive supports the arguments :
```caddy
(log_common) {
log {
output file /var/log/caddy/{args.0}.access.log
}
}
```
And then you can reuse it anywhere with parameters:
```caddy-d
a.example.com {
import log_common a.example.com
}
b.example.com {
import log_common b.example.com
}
```
## Comments ## Comments