How to make caddy file-server write its JSON config when run from commandline?

I would like caddy to save its config when run from commandline with the file-server option (and various file-server options after that). It would make it easier to get a clean JSON config template to incorporate in my existing config. Is it possible ?

While it’s running, you can make requests to the admin API (I think, unless the caddy file-server command turns off the admin API, I forget if it does) to get the current config.

But I’d strongly recommend using a Caddyfile config instead, if you’re just getting started. It’s a much more user-friendly starting point.