rspamd: Use redis over a unix socket by default
Both rspamd and redis run on the same host by default, so a UNIX domain socket is the cheapest way to facilitate that communication. It also allows us to get rid of overly complicated IP adddress parsing logic, that we can shift onto the user if they need it.
This commit is contained in:
23
default.nix
23
default.nix
@@ -944,28 +944,19 @@ in
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
# read the default from nixos' redis module
|
||||
default = let
|
||||
cf = config.services.redis.servers.rspamd.bind;
|
||||
cfdefault = if cf == null then "127.0.0.1" else cf;
|
||||
ips = lib.strings.splitString " " cfdefault;
|
||||
ip = lib.lists.head (ips ++ [ "127.0.0.1" ]);
|
||||
isIpv6 = ip: lib.lists.elem ":" (lib.stringToCharacters ip);
|
||||
in
|
||||
if (ip == "0.0.0.0" || ip == "::")
|
||||
then "127.0.0.1"
|
||||
else if isIpv6 ip then "[${ip}]" else ip;
|
||||
defaultText = lib.literalMD "computed from `config.services.redis.servers.rspamd.bind`";
|
||||
default = config.services.redis.servers.rspamd.unixSocket;
|
||||
defaultText = lib.literalExpression "config.services.redis.servers.rspamd.unixSocket";
|
||||
description = ''
|
||||
Address that rspamd should use to contact redis.
|
||||
Path, IP address or hostname that Rspamd should use to contact Redis.
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = config.services.redis.servers.rspamd.port;
|
||||
defaultText = lib.literalExpression "config.services.redis.servers.rspamd.port";
|
||||
type = with types; nullOr port;
|
||||
default = null;
|
||||
example = lib.literalExpression "config.services.redis.servers.rspamd.port";
|
||||
description = ''
|
||||
Port that rspamd should use to contact redis.
|
||||
Port that Rspamd should use to contact Redis.
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user