From 47b97b8262862694d588be91a7fcd1613e8ed38e Mon Sep 17 00:00:00 2001 From: Arthur T Date: Fri, 7 May 2021 21:16:53 +0200 Subject: [PATCH] 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 --- src/docs/markdown/caddyfile/concepts.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/docs/markdown/caddyfile/concepts.md b/src/docs/markdown/caddyfile/concepts.md index 971dc2d..4a18b22 100644 --- a/src/docs/markdown/caddyfile/concepts.md +++ b/src/docs/markdown/caddyfile/concepts.md @@ -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 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