Merge pull request #153729 from aanderse/nixos/caddy

nixos/caddy: add globalConfig option

authored by Aaron Andersen and committed by GitHub 2e95239b 0578da5e

+28 -5
+28 -5
nixos/modules/services/web-servers/caddy/default.nix
··· 28 let 29 Caddyfile = pkgs.writeText "Caddyfile" '' 30 { 31 - ${optionalString (cfg.email != null) "email ${cfg.email}"} 32 - ${optionalString (cfg.acmeCA != null) "acme_ca ${cfg.acmeCA}"} 33 - log { 34 - ${cfg.logFormat} 35 - } 36 } 37 ${cfg.extraConfig} 38 ''; ··· 183 ''; 184 }; 185 186 extraConfig = mkOption { 187 type = types.lines; 188 default = ""; ··· 253 ]; 254 255 services.caddy.extraConfig = concatMapStringsSep "\n" mkVHostConf virtualHosts; 256 257 systemd.packages = [ cfg.package ]; 258 systemd.services.caddy = {
··· 28 let 29 Caddyfile = pkgs.writeText "Caddyfile" '' 30 { 31 + ${cfg.globalConfig} 32 } 33 ${cfg.extraConfig} 34 ''; ··· 179 ''; 180 }; 181 182 + globalConfig = mkOption { 183 + type = types.lines; 184 + default = ""; 185 + example = '' 186 + debug 187 + servers { 188 + protocol { 189 + experimental_http3 190 + } 191 + } 192 + ''; 193 + description = '' 194 + Additional lines of configuration appended to the global config section 195 + of the <literal>Caddyfile</literal>. 196 + 197 + Refer to <link xlink:href="https://caddyserver.com/docs/caddyfile/options#global-options"/> 198 + for details on supported values. 199 + ''; 200 + }; 201 + 202 extraConfig = mkOption { 203 type = types.lines; 204 default = ""; ··· 269 ]; 270 271 services.caddy.extraConfig = concatMapStringsSep "\n" mkVHostConf virtualHosts; 272 + services.caddy.globalConfig = '' 273 + ${optionalString (cfg.email != null) "email ${cfg.email}"} 274 + ${optionalString (cfg.acmeCA != null) "acme_ca ${cfg.acmeCA}"} 275 + log { 276 + ${cfg.logFormat} 277 + } 278 + ''; 279 280 systemd.packages = [ cfg.package ]; 281 systemd.services.caddy = {