From 307f3c61bfef83cae837aba7f74c339a409b781c Mon Sep 17 00:00:00 2001 From: Juwen Lie Date: Fri, 27 Nov 2026 08:19:55 +0700 Subject: [PATCH] Token Board: no built-in dashboard token, read it from config.json The dashboard access token now comes only from token_board.dashboard_token in config.json. With no token set, the board says so instead of calling the dashboard. --- pips/token_board.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pips/token_board.py b/pips/token_board.py index d92d76c..fc27065 100644 --- a/pips/token_board.py +++ b/pips/token_board.py @@ -70,7 +70,7 @@ DEFAULTS = { "user": "", "dashboard_base": "https://monitor.example.com", - "dashboard_token": "5c22b4c5a91c4f26a10d73b63f333c3e", + "dashboard_token": "", # set token_board.dashboard_token in config.json "user_panel": 112, "top_n": 30, "long_range": "now-5y", @@ -398,6 +398,8 @@ def _http_json(url: str, payload: dict | None = None, timeout: float = 60.0) -> def query_user_panel(conf: dict, time_from: str, time_to: str = "now") -> list: """Rows [level1, unit, user, uses, tokens, days] sorted by tokens desc.""" + if not conf.get("dashboard_token"): + raise RuntimeError("token_board.dashboard_token is not set in config.json") url = (f"{conf['dashboard_base']}/api/public/dashboards/" f"{conf['dashboard_token']}/panels/{int(conf['user_panel'])}/query") payload = {