lnd: use type str for rpclisten, restlisten
This commit is contained in:
parent
8b053326cc
commit
de23fdd377
@ -14,7 +14,7 @@ let
|
|||||||
tlscertpath=${secretsDir}/loop-cert
|
tlscertpath=${secretsDir}/loop-cert
|
||||||
tlskeypath=${secretsDir}/loop-key
|
tlskeypath=${secretsDir}/loop-key
|
||||||
|
|
||||||
lnd.host=${builtins.elemAt config.services.lnd.rpclisten 0}:${toString config.services.lnd.rpcPort}
|
lnd.host=${config.services.lnd.rpclisten}:${toString config.services.lnd.rpcPort}
|
||||||
lnd.macaroondir=${config.services.lnd.networkDir}
|
lnd.macaroondir=${config.services.lnd.networkDir}
|
||||||
lnd.tlspath=${secretsDir}/lnd-cert
|
lnd.tlspath=${secretsDir}/lnd-cert
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ let
|
|||||||
tlskeypath=${secretsDir}/lnd-key
|
tlskeypath=${secretsDir}/lnd-key
|
||||||
|
|
||||||
listen=${toString cfg.listen}:${toString cfg.listenPort}
|
listen=${toString cfg.listen}:${toString cfg.listenPort}
|
||||||
${lib.concatMapStrings (rpclisten: "rpclisten=${rpclisten}:${toString cfg.rpcPort}\n") cfg.rpclisten}
|
rpclisten=${cfg.rpclisten}
|
||||||
${lib.concatMapStrings (restlisten: "restlisten=${restlisten}:${toString cfg.restPort}\n") cfg.restlisten}
|
restlisten=${cfg.restlisten}
|
||||||
|
|
||||||
bitcoin.${bitcoind.network}=1
|
bitcoin.${bitcoind.network}=1
|
||||||
bitcoin.active=1
|
bitcoin.active=1
|
||||||
@ -66,15 +66,15 @@ in {
|
|||||||
description = "Bind to given port to listen to peer connections";
|
description = "Bind to given port to listen to peer connections";
|
||||||
};
|
};
|
||||||
rpclisten = mkOption {
|
rpclisten = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.str;
|
||||||
default = [ "localhost" ];
|
default = "localhost";
|
||||||
description = ''
|
description = ''
|
||||||
Bind to given address to listen to RPC connections.
|
Bind to given address to listen to RPC connections.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
restlisten = mkOption {
|
restlisten = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.str;
|
||||||
default = [ "localhost" ];
|
default = "localhost";
|
||||||
description = ''
|
description = ''
|
||||||
Bind to given address to listen to REST connections.
|
Bind to given address to listen to REST connections.
|
||||||
'';
|
'';
|
||||||
@ -139,7 +139,7 @@ in {
|
|||||||
# Switch user because lnd makes datadir contents readable by user only
|
# Switch user because lnd makes datadir contents readable by user only
|
||||||
''
|
''
|
||||||
sudo -u lnd ${cfg.package}/bin/lncli \
|
sudo -u lnd ${cfg.package}/bin/lncli \
|
||||||
--rpcserver ${builtins.elemAt cfg.rpclisten 0}:${toString cfg.rpcPort} \
|
--rpcserver ${cfg.rpclisten}:${toString cfg.rpcPort} \
|
||||||
--tlscertpath '${secretsDir}/lnd-cert' \
|
--tlscertpath '${secretsDir}/lnd-cert' \
|
||||||
--macaroonpath '${networkDir}/admin.macaroon' "$@"
|
--macaroonpath '${networkDir}/admin.macaroon' "$@"
|
||||||
'';
|
'';
|
||||||
@ -189,12 +189,12 @@ in {
|
|||||||
RestartSec = "10s";
|
RestartSec = "10s";
|
||||||
ReadWritePaths = "${cfg.dataDir}";
|
ReadWritePaths = "${cfg.dataDir}";
|
||||||
ExecStartPost = let
|
ExecStartPost = let
|
||||||
restUrl = "https://${builtins.elemAt cfg.restlisten 0}:${toString cfg.restPort}/v1";
|
restUrl = "https://${cfg.restlisten}:${toString cfg.restPort}/v1";
|
||||||
in [
|
in [
|
||||||
# Run fully privileged for secrets dir write access
|
# Run fully privileged for secrets dir write access
|
||||||
"+${nix-bitcoin-services.script ''
|
"+${nix-bitcoin-services.script ''
|
||||||
attempts=250
|
attempts=250
|
||||||
while ! { exec 3>/dev/tcp/${builtins.elemAt cfg.restlisten 0}/${toString cfg.restPort} && exec 3>&-; } &>/dev/null; do
|
while ! { exec 3>/dev/tcp/${cfg.restlisten}/${toString cfg.restPort} && exec 3>&-; } &>/dev/null; do
|
||||||
((attempts-- == 0)) && { echo "lnd REST service unreachable"; exit 1; }
|
((attempts-- == 0)) && { echo "lnd REST service unreachable"; exit 1; }
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
done
|
done
|
||||||
@ -236,7 +236,7 @@ in {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Wait until the RPC port is open
|
# Wait until the RPC port is open
|
||||||
while ! { exec 3>/dev/tcp/${builtins.elemAt cfg.rpclisten 0}/${toString cfg.rpcPort}; } &>/dev/null; do
|
while ! { exec 3>/dev/tcp/${cfg.rpclisten}/${toString cfg.rpcPort}; } &>/dev/null; do
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -264,8 +264,8 @@ in {
|
|||||||
|
|
||||||
services.lnd = {
|
services.lnd = {
|
||||||
listen = netns.lnd.address;
|
listen = netns.lnd.address;
|
||||||
rpclisten = [ netns.lnd.address ];
|
rpclisten = netns.lnd.address;
|
||||||
restlisten = [ netns.lnd.address ];
|
restlisten = netns.lnd.address;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.liquidd = {
|
services.liquidd = {
|
||||||
|
Loading…
Reference in New Issue
Block a user