{host}
only exists when there’s an incoming HTTP request.
When Caddy starts, it needs to create a log file, but since there’s no HTTP request at that moment, there’s no {host}
value available. In other words, {host}
doesn’t exist yet during Caddy’s startup, so it can’t be used at that point.
@francislavoie clearly explains that here.
In the links you provided, they are using hardcoded values instead. So, in your case, you’d have to use somethign like this:
# ...
ha.[REDACT] homeassistant.[REDACT] {
import rp {env.DUCKDNS_API_TOKEN} http://10.27.0.50:8123 ha.[REDACT]
}
# ...