The {$VAR}
style environment placeholders are Caddyfile-specific. Those are replaced at Caddyfile-adapt time, i.e. before the Caddyfile is transformed into a JSON config.
The {env.VAR}
style does work in JSON, but only in locations where the given module actually attempts to replace the config value.
It’s not possible to expand one config value into multiple; trying to support that would add significant complexity to Caddy which isn’t worth it.
Instead, you should write a script that replaces the values in your JSON before passing it to Caddy. You might use jq
for this (Google it – command line tool to manipulate JSON)