nixos/caddy: add support for Caddy v2 #86686
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 official upstream systemd service files with explanation at https://github.com/caddyserver/dist/tree/master/init.
In compare to v1 the Caddy v2 starts without configuration file and best practice in v2 is to use API to upload config. JSON is native format, but with simple curl POST it is possible to upload regular Caddyfile too. Caddy reloads last state after restart. All that is working with https://github.com/caddyserver/dist/blob/master/init/caddy-api.service.
In my opinion that this should be default in NixOS. The configuration file should be added to command line arguments only if additional parameters related to configuration source and provider are specified.