diff options
author | Martin Minka <martin.minka@gmail.com> | 2020-12-13 23:14:56 +0100 |
---|---|---|
committer | Raphael Megzari <raphael@megzari.com> | 2021-08-17 18:46:29 +0900 |
commit | 22719ca7de0b005426aae093e85e4abe91318fe6 (patch) | |
tree | b3fce5999fb8eb19489c7e55636a8f967678c51f /nixos | |
parent | ec6dee00ecfe25065e658f35eee78ad517b8a605 (diff) | |
download | nixpkgs-22719ca7de0b005426aae093e85e4abe91318fe6.tar nixpkgs-22719ca7de0b005426aae093e85e4abe91318fe6.tar.gz nixpkgs-22719ca7de0b005426aae093e85e4abe91318fe6.tar.bz2 nixpkgs-22719ca7de0b005426aae093e85e4abe91318fe6.tar.lz nixpkgs-22719ca7de0b005426aae093e85e4abe91318fe6.tar.xz nixpkgs-22719ca7de0b005426aae093e85e4abe91318fe6.tar.zst nixpkgs-22719ca7de0b005426aae093e85e4abe91318fe6.zip |
nixos/caddy: add resume option
Without this option all changes done with Caddy API are lost after reboot. Current service is not supporting Caddy --resume parameter. There is reference to original unit https://github.com/caddyserver/dist/blob/master/init/caddy.service which also mentions --resume and that it should be used if new Caddy API will be used.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/web-servers/caddy.nix | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nixos/modules/services/web-servers/caddy.nix b/nixos/modules/services/web-servers/caddy.nix index b0565fcea16..0a059723ccc 100644 --- a/nixos/modules/services/web-servers/caddy.nix +++ b/nixos/modules/services/web-servers/caddy.nix @@ -90,6 +90,14 @@ in ''; }; + resume = mkOption { + default = false; + type = types.bool; + description = '' + Use saved config, if any (and prefer over configuration passed with <option>services.caddy.config</option>). + ''; + }; + ca = mkOption { default = "https://acme-v02.api.letsencrypt.org/directory"; example = "https://acme-staging-v02.api.letsencrypt.org/directory"; @@ -142,7 +150,7 @@ in startLimitIntervalSec = 14400; startLimitBurst = 10; serviceConfig = { - ExecStart = "${cfg.package}/bin/caddy run --config ${configJSON}"; + ExecStart = "${cfg.package}/bin/caddy run ${optionalString cfg.resume "--resume"} --config ${configJSON}"; ExecReload = "${cfg.package}/bin/caddy reload --config ${configJSON}"; Type = "simple"; User = cfg.user; |