nodeinfo: extract fn mkInfoLong
This is required by the mempool extension flake.
This commit is contained in:
parent
2af642f56a
commit
690a8f6256
@ -73,9 +73,10 @@ let
|
|||||||
return
|
return
|
||||||
info["onion_address"] = f"{onion_address}:{port}"
|
info["onion_address"] = f"{onion_address}:{port}"
|
||||||
|
|
||||||
def add_service(service, make_info):
|
def add_service(service, make_info, systemd_service = None):
|
||||||
if not is_active(service):
|
systemd_service = systemd_service or service
|
||||||
infos[service] = "service is not running"
|
if not is_active(systemd_service):
|
||||||
|
infos[service] = f"'{systemd_service}.service' is not running"
|
||||||
else:
|
else:
|
||||||
info = OrderedDict()
|
info = OrderedDict()
|
||||||
exec(make_info, globals(), locals())
|
exec(make_info, globals(), locals())
|
||||||
@ -96,14 +97,19 @@ let
|
|||||||
) (builtins.attrNames cfg.services);
|
) (builtins.attrNames cfg.services);
|
||||||
|
|
||||||
nodeinfoLib = rec {
|
nodeinfoLib = rec {
|
||||||
mkInfo = extraCode: name: cfg: ''
|
mkInfo = extraCode: name: cfg:
|
||||||
|
mkInfoLong {
|
||||||
|
inherit extraCode name cfg;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkInfoLong = { extraCode ? "", name, cfg, systemdServiceName ? name }: ''
|
||||||
add_service("${name}", """
|
add_service("${name}", """
|
||||||
info["local_address"] = "${nbLib.addressWithPort cfg.address cfg.port}"
|
info["local_address"] = "${nbLib.addressWithPort cfg.address cfg.port}"
|
||||||
'' + mkIfOnionPort name (onionPort: ''
|
'' + mkIfOnionPort name (onionPort: ''
|
||||||
set_onion_address(info, "${name}", ${onionPort})
|
set_onion_address(info, "${name}", ${onionPort})
|
||||||
'') + extraCode + ''
|
'') + extraCode + ''
|
||||||
|
|
||||||
""")
|
""", "${systemdServiceName}")
|
||||||
'';
|
'';
|
||||||
|
|
||||||
mkIfOnionPort = name: fn:
|
mkIfOnionPort = name: fn:
|
||||||
|
Loading…
Reference in New Issue
Block a user