nixos/rspamd: Add defaults for rspamd_proxy worker

This commit is contained in:
Brian Olsen 2018-11-06 00:32:14 +01:00
parent 3a4459a305
commit 46ef075e7d
No known key found for this signature in database
GPG Key ID: 029DD8E8B95882E8

View File

@ -58,7 +58,7 @@ let
}; };
type = mkOption { type = mkOption {
type = types.nullOr (types.enum [ type = types.nullOr (types.enum [
"normal" "controller" "fuzzy_storage" "proxy" "lua" "normal" "controller" "fuzzy_storage" "rspamd_proxy" "lua"
]); ]);
description = "The type of this worker"; description = "The type of this worker";
}; };
@ -99,18 +99,20 @@ let
description = "Additional entries to put verbatim into worker section of rspamd config file."; description = "Additional entries to put verbatim into worker section of rspamd config file.";
}; };
}; };
config = mkIf (name == "normal" || name == "controller" || name == "fuzzy") { config = mkIf (name == "normal" || name == "controller" || name == "fuzzy" || name == "rspamd_proxy") {
type = mkDefault name; type = mkDefault name;
includes = mkDefault [ "$CONFDIR/worker-${name}.inc" ]; includes = mkDefault [ "$CONFDIR/worker-${if name == "rspamd_proxy" then "proxy" else name}.inc" ];
bindSockets = mkDefault (if name == "normal" bindSockets =
then [{ let
socket = "/run/rspamd/rspamd.sock"; unixSocket = name: {
mode = "0660"; mode = "0660";
socket = "/run/rspamd/${name}.sock";
owner = cfg.user; owner = cfg.user;
group = cfg.group; group = cfg.group;
}] };
else if name == "controller" in mkDefault (if name == "normal" then [(unixSocket "rspamd")]
then [ "localhost:11334" ] else if name == "controller" then [ "localhost:11334" ]
else if name == "rspamd_proxy" then [ (unixSocket "proxy") ]
else [] ); else [] );
}; };
}; };