nixos/caddy: force caddy to reload config in ExecReload

This patch follows an upstream commit[1].

Before this patch, if acme module is used, caddy will still use an old
cert even a new one is available. The cause is that without --force
flag, caddy will not reload an unchanged config.

Refer to that commit[1] message for more information.

[1]: 979e498d6d
This commit is contained in:
Lin Jian 2022-06-29 10:32:52 +08:00
parent f4bbd5d420
commit d1b90cf540
No known key found for this signature in database
GPG Key ID: A6698D36434F75A5

View File

@ -299,7 +299,7 @@ in
# https://www.freedesktop.org/software/systemd/man/systemd.service.html#ExecStart=
# If the empty string is assigned to this option, the list of commands to start is reset, prior assignments of this option will have no effect.
ExecStart = [ "" "${cfg.package}/bin/caddy run --config ${cfg.configFile} --adapter ${cfg.adapter} ${optionalString cfg.resume "--resume"}" ];
ExecReload = [ "" "${cfg.package}/bin/caddy reload --config ${cfg.configFile} --adapter ${cfg.adapter}" ];
ExecReload = [ "" "${cfg.package}/bin/caddy reload --config ${cfg.configFile} --adapter ${cfg.adapter} --force" ];
ExecStartPre = "${cfg.package}/bin/caddy validate --config ${cfg.configFile} --adapter ${cfg.adapter}";
User = cfg.user;