I want use Caddyfile to caddy config from a http url because I want to keep the secret http url in an environment variable (just like load/http - json/admin/config/load/http — Caddy Documentation but instead of json, I want caddyfile. I didn’t find any relevant documentation for that.
You can have your Caddyfile pull the value from env vars, no need to use admin to load the config. See Caddyfile Concepts — Caddy Documentation you do something like {env.CLOUDFLARE_API_TOKEN}
This is the json config that I need. This doesn’t work because I need to resolve environment variables $CADDY_CONFIG_URL and $ADMIN_LISTEN_ADDR. If I have an equivalent Caddyfile, then I can use environment variables.
There are 2 different types of environment variables, one is Caddyfile-specific and is replaced at parse-time (e.g. {$HOST}), while the other is more general and is replaced at runtime (e.g. {env.HOST}).