Skip to content

Commit 44c5bcd

Browse files
Log and spark logs tweaks
1 parent f903ec8 commit 44c5bcd

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

nixos/admin-app/app.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,8 @@
208208
{"key": "spark", "label": "Spark", "unit": "spark-sidecar.service"},
209209
{"key": "ark", "label": "Ark", "unit": "arkade-sidecar.service"},
210210
{"key": "caddy", "label": "Caddy", "unit": "caddy.service"},
211-
{"key": "system", "label": "System", "unit": None},
212211
{"key": "tunnel", "label": "Tunnel", "unit": f"{TUNNEL_SERVICE_NAME}.service"},
213212
{"key": "tor", "label": "Tor", "unit": "tor.service"},
214-
{"key": "admin", "label": "Admin App", "unit": "lnbitspi-admin.service"},
215213
]
216214
LOG_SERVICE_BY_KEY = {entry["key"]: entry for entry in LOG_SERVICE_OPTIONS}
217215
FUNDING_LOG_KEYS = {"spark", "ark", "phoenixd"}
@@ -359,11 +357,28 @@ def _funding_sources_payload() -> dict[str, Any]:
359357
for key, value in FUNDING_SOURCES.items()
360358
},
361359
"spark": {
362-
"balance": get_spark_balance(),
360+
"balance": get_spark_balance() if selected == "spark" else None,
363361
"seed_present": bool(_read_spark_mnemonic()),
364362
},
365-
"arkade": get_arkade_status(),
366-
"phoenixd": get_phoenixd_status(),
363+
"arkade": (
364+
get_arkade_status()
365+
if selected == "ark"
366+
else {
367+
"seed_present": bool(_read_arkade_mnemonic()),
368+
"balance": None,
369+
"mnemonic_missing": False,
370+
}
371+
),
372+
"phoenixd": (
373+
get_phoenixd_status()
374+
if selected == "phoenixd"
375+
else {
376+
"seed_present": bool(_read_phoenixd_seed()),
377+
"balance": None,
378+
"channels": [],
379+
"channel_count": 0,
380+
}
381+
),
367382
}
368383

369384

@@ -1471,7 +1486,7 @@ def get_spark_balance():
14711486
try:
14721487
import requests
14731488
api_key = _read_sidecar_api_key(SPARK_API_KEY_FILE, "SPARK_SIDECAR_API_KEY")
1474-
headers = {"X-API-KEY": api_key} if api_key else {}
1489+
headers = {"X-API-Key": api_key} if api_key else {}
14751490
resp = requests.post(f"{SPARK_URL}/v1/balance", headers=headers, timeout=5)
14761491
if resp.ok:
14771492
data = resp.json()
@@ -1650,7 +1665,7 @@ def collect_stats():
16501665
},
16511666
"funding_sources": funding_sources,
16521667
"funding_source": _read_selected_funding_source(),
1653-
"spark_balance": get_spark_balance(),
1668+
"spark_balance": funding_sources.get("spark", {}).get("balance"),
16541669
"arkade_status": funding_sources.get("arkade", {}),
16551670
"phoenixd_status": funding_sources.get("phoenixd", {}),
16561671
"tor_onion": get_onion_address(),

0 commit comments

Comments
 (0)