feat: show masked config/secrets on dashboard for deployment debugging
All checks were successful
Deploy / deploy (push) Successful in 12s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-08 11:59:28 +01:00
parent f59ae520bd
commit 614b0114b4

View File

@@ -495,6 +495,17 @@ async def dashboard():
pull_html = _sync_entry_html(s["last_pull"])
push_html = _sync_entry_html(s["last_push"])
def _mask(val: str) -> str:
if not val:
return '<span style="color:#dc3545">NOT SET</span>'
if len(val) <= 10:
return "***"
return f'<code>{val[:6]}***{val[-4:]}</code>'
outline_url = os.environ.get("OUTLINE_URL", "")
outline_tok = _mask(os.environ.get("OUTLINE_TOKEN", ""))
ts_authkey = _mask(os.environ.get("TS_AUTHKEY", ""))
body = f"""
<div class="card">
<h2>Vault Status</h2>
@@ -511,6 +522,16 @@ async def dashboard():
<a href="/changes" class="btn btn-secondary">Preview Changes</a>
</div>
<div id="output"></div>
</div>
<div class="card" style="margin-top:12px">
<h2>Config</h2>
<table>
<tr><th>Key</th><th>Value</th></tr>
<tr><td>OUTLINE_URL</td><td><code>{outline_url or '<span style="color:#dc3545">NOT SET</span>'}</code></td></tr>
<tr><td>OUTLINE_TOKEN</td><td>{outline_tok}</td></tr>
<tr><td>TS_AUTHKEY</td><td>{ts_authkey}</td></tr>
<tr><td>APP_VERSION</td><td><code>{APP_VERSION}</code></td></tr>
</table>
</div>"""
return HTMLResponse(_page("Dashboard", body))