Which has gotten me thinking about the appropriate place to do variable replacements?
I am wondering if we should remove any of the replacement processes that the Caddyfile adapter does and instead pass these through to the underlying module. This would also mean that running the adapt command on the first Caddyfile would transform it into the second file. Currently this is being done in the Caddyfile itself. https://github.com/caddyserver/caddy/blob/master/caddyfile/parse.go#L419
In v1, we needed the env placeholders embedded into the Caddyfile parser, which I always kind of hated, but you’re right, I don’t think we need to do that in v2. Let’s just parse it like normal, and let the underlying module deal with the replacements. This will make the feature simpler, more consistent, more correct, and more useful.