From b6d1928e905079ef8004c3b8fabab1a3f76cf64b Mon Sep 17 00:00:00 2001 From: kon Date: Tue, 26 Oct 2021 21:27:48 +0200 Subject: [PATCH] clightning: add public port Co-authored-by: Erik Arvstedt --- modules/clightning.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/clightning.nix b/modules/clightning.nix index 19d8b31..8220ad8 100644 --- a/modules/clightning.nix +++ b/modules/clightning.nix @@ -90,6 +90,12 @@ let rpc-file-mode=0660 ${cfg.extraConfig} ''; + + # If the clightning onion service is enabled, use the onion port as the public port + publicPort = if config.nix-bitcoin.onionServices.clightning.enable or false then + (builtins.elemAt config.services.tor.relay.onionServices.clightning.map 0).port + else + cfg.port; in { inherit options; @@ -119,7 +125,7 @@ in { { echo "bitcoin-rpcpassword=$(cat ${config.nix-bitcoin.secretsDir}/bitcoin-rpcpassword-public)" ${optionalString (cfg.getPublicAddressCmd != "") '' - echo "announce-addr=$(${cfg.getPublicAddressCmd})" + echo "announce-addr=$(${cfg.getPublicAddressCmd}):${toString publicPort}" ''} } >> '${cfg.dataDir}/config' '';