Skip to content

Commit

Permalink
caddy service: add options to change ACME certificate authority (#16969)
Browse files Browse the repository at this point in the history
and agree to let's encrypt subscriber agreement
  • Loading branch information
davidak authored and garbas committed Jul 20, 2016
1 parent cd25b04 commit 83bdc8e
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions nixos/modules/services/web-servers/caddy.nix
Expand Up @@ -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;
Expand All @@ -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";
};
};

Expand Down

0 comments on commit 83bdc8e

Please sign in to comment.