For example, I currently have a massive list of:
one.example.com {
proxy / https://one.example.com:9000 {
transparent
}
log /var/log/caddy/access.one.example.com.log
errors /var/log/caddy/error.one.example.com.log
}
two.example.com {
proxy / https://two.example.com:9000 {
transparent
}
log /var/log/caddy/access.two.example.com.log
errors /var/log/caddy/error.two.example.com.log
}
three.example.com {
proxy / https://three.example.com:9000 {
transparent
}
log /var/log/caddy/access.three.example.com.log
errors /var/log/caddy/error.three.example.com.log
}
I couldn’t see how snippets could work for me here. If they could, I think the docs could cement with clearer examples.
I want to describe my caddyfile something like this:
- modules/template1
- Caddyfile
modules/template1
:
{$domain} {
proxy / https://{$domain}:9000 {
transparent
}
log /var/log/caddy/access.{$domain}.log
errors /var/log/caddy/error.{$domain}.log
}
Caddyfile
:
from modules import template1
template1 {
domain one.example.com
}
template1 {
domain two.example.com
}
template1 {
domain three.example.com
}
I hope the above conveys the point. Is there a way to define a function with input variables?