bitcoind: group rpc options under parent option 'rpc'

This commit is contained in:
Erik Arvstedt 2021-01-14 13:24:02 +01:00
parent 5b7e0d09b2
commit dd4a0238f9
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
3 changed files with 16 additions and 16 deletions

View File

@ -33,7 +33,7 @@ let
rpcbind=${cfg.rpc.address} rpcbind=${cfg.rpc.address}
rpcport=${toString cfg.rpc.port} rpcport=${toString cfg.rpc.port}
rpcconnect=${cfg.rpc.address} rpcconnect=${cfg.rpc.address}
${optionalString (cfg.rpc.threads != null) "rpcthreads=${toString cfg.rpcthreads}"} ${optionalString (cfg.rpc.threads != null) "rpcthreads=${toString cfg.rpc.threads}"}
rpcwhitelistdefault=0 rpcwhitelistdefault=0
${concatMapStrings (user: '' ${concatMapStrings (user: ''
${optionalString (!user.passwordHMACFromFile) "rpcauth=${user.name}:${passwordHMAC}"} ${optionalString (!user.passwordHMACFromFile) "rpcauth=${user.name}:${passwordHMAC}"}
@ -41,7 +41,7 @@ let
"rpcwhitelist=${user.name}:${lib.strings.concatStringsSep "," user.rpcwhitelist}"} "rpcwhitelist=${user.name}:${lib.strings.concatStringsSep "," user.rpcwhitelist}"}
'') (builtins.attrValues cfg.rpc.users) '') (builtins.attrValues cfg.rpc.users)
} }
${lib.concatMapStrings (rpcallowip: "rpcallowip=${rpcallowip}\n") cfg.rpcallowip} ${lib.concatMapStrings (rpcallowip: "rpcallowip=${rpcallowip}\n") cfg.rpc.allowip}
# Wallet options # Wallet options
${optionalString (cfg.addresstype != null) "addresstype=${cfg.addresstype}"} ${optionalString (cfg.addresstype != null) "addresstype=${cfg.addresstype}"}
@ -110,6 +110,18 @@ in {
default = 8332; default = 8332;
description = "Port to listen for JSON-RPC connections."; description = "Port to listen for JSON-RPC connections.";
}; };
threads = mkOption {
type = types.nullOr types.ints.u16;
default = null;
description = "The number of threads to service RPC calls.";
};
allowip = mkOption {
type = types.listOf types.str;
default = [ "127.0.0.1" ];
description = ''
Allow JSON-RPC connections from specified sources.
'';
};
users = mkOption { users = mkOption {
default = {}; default = {};
example = { example = {
@ -154,18 +166,6 @@ in {
''; '';
}; };
}; };
rpcthreads = mkOption {
type = types.nullOr types.ints.u16;
default = null;
description = "Set the number of threads to service RPC calls";
};
rpcallowip = mkOption {
type = types.listOf types.str;
default = [ "127.0.0.1" ];
description = ''
Allow JSON-RPC connections from specified source.
'';
};
regtest = mkOption { regtest = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;

View File

@ -247,7 +247,7 @@ in {
services.bitcoind = { services.bitcoind = {
address = netns.bitcoind.address; address = netns.bitcoind.address;
rpc.address = netns.bitcoind.address; rpc.address = netns.bitcoind.address;
rpcallowip = [ rpc.allowip = [
bridgeIp # For operator user bridgeIp # For operator user
netns.bitcoind.address netns.bitcoind.address
] ++ map (n: netns.${n}.address) netns.bitcoind.availableNetns; ] ++ map (n: netns.${n}.address) netns.bitcoind.availableNetns;

View File

@ -60,7 +60,7 @@ in {
dbCache = 1000; dbCache = 1000;
# higher rpcthread count due to reports that lightning implementations fail # higher rpcthread count due to reports that lightning implementations fail
# under high bitcoind rpc load # under high bitcoind rpc load
rpcthreads = 16; rpc.threads = 16;
}; };
services.tor.hiddenServices.bitcoind = mkHiddenService { port = cfg.bitcoind.port; toHost = cfg.bitcoind.address; }; services.tor.hiddenServices.bitcoind = mkHiddenService { port = cfg.bitcoind.port; toHost = cfg.bitcoind.address; };