caddy service: add options to change ACME certificate authority (#16969)

and agree to let's encrypt subscriber agreement
This commit is contained in:
davidak 2016-07-21 01:51:09 +02:00 committed by Rok Garbas
parent cd25b04dbb
commit 83bdc8e858

View File

@ -14,12 +14,26 @@ in
description = "Verbatim Caddyfile to use";
};
ca = mkOption {
default = "https://acme-v01.api.letsencrypt.org/directory";
example = "https://acme-staging.api.letsencrypt.org/directory";
type = types.string;
description = "Certificate authority ACME server. The default (Let's Encrypt production server) should be fine for most people.";
};
email = mkOption {
default = "";
type = types.string;
description = "Email address (for Let's Encrypt certificate)";
};
agree = mkOption {
default = false;
example = true;
type = types.bool;
description = "Agree to Let's Encrypt Subscriber Agreement";
};
dataDir = mkOption {
default = "/var/lib/caddy";
type = types.path;
@ -33,11 +47,13 @@ in
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.caddy.bin}/bin/caddy -conf=${configFile} -email=${cfg.email}";
Type = "simple";
User = "caddy";
Group = "caddy";
AmbientCapabilities = "cap_net_bind_service";
ExecStart = ''${pkgs.caddy.bin}/bin/caddy -conf=${configFile} \
-ca=${cfg.ca} -email=${cfg.email} ${optionalString cfg.agree "-agree"}
'';
Type = "simple";
User = "caddy";
Group = "caddy";
AmbientCapabilities = "cap_net_bind_service";
};
};