caddy service: add options to change ACME certificate authority (#16969)
and agree to let's encrypt subscriber agreement
This commit is contained in:
parent
cd25b04dbb
commit
83bdc8e858
|
@ -14,12 +14,26 @@ in
|
||||||
description = "Verbatim Caddyfile to use";
|
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 {
|
email = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
type = types.string;
|
type = types.string;
|
||||||
description = "Email address (for Let's Encrypt certificate)";
|
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 {
|
dataDir = mkOption {
|
||||||
default = "/var/lib/caddy";
|
default = "/var/lib/caddy";
|
||||||
type = types.path;
|
type = types.path;
|
||||||
|
@ -33,11 +47,13 @@ in
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.caddy.bin}/bin/caddy -conf=${configFile} -email=${cfg.email}";
|
ExecStart = ''${pkgs.caddy.bin}/bin/caddy -conf=${configFile} \
|
||||||
Type = "simple";
|
-ca=${cfg.ca} -email=${cfg.email} ${optionalString cfg.agree "-agree"}
|
||||||
User = "caddy";
|
'';
|
||||||
Group = "caddy";
|
Type = "simple";
|
||||||
AmbientCapabilities = "cap_net_bind_service";
|
User = "caddy";
|
||||||
|
Group = "caddy";
|
||||||
|
AmbientCapabilities = "cap_net_bind_service";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue