Unverified Commit cf523f3f authored by Gergely Nagy's avatar Gergely Nagy
Browse files

nixos/caddy: Make virtualHosts' logFormat optional



Allow `services.caddy.virtualHosts.<name>.logFormat` to be null, and in
that case, do not add a `log {}` block to the Caddy configuration. This
makes it possible to have multiple loggers declared in the global
configuration, and instruct Caddy to use a logger by name.

Signed-off-by: default avatarGergely Nagy <me@gergo.csillger.hu>
parent e0c78f42
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -30,9 +30,11 @@ let
        ${optionalString (
          hostOpts.useACMEHost != null
        ) "tls ${sslCertDir}/cert.pem ${sslCertDir}/key.pem"}
        ${optionalString (hostOpts.logFormat != null) ''
          log {
            ${hostOpts.logFormat}
          }
        ''}

        ${hostOpts.extraConfig}
      }
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ in
    };

    logFormat = mkOption {
      type = types.lines;
      type = types.nullOr types.lines;
      default = ''
        output file ${cfg.logDir}/access-${lib.replaceStrings [ "/" " " ] [ "_" "_" ] config.hostName}.log
      '';