SIGN IN SIGN UP

fix(telemetry): honor --config flag in enable/disable save path (#375)

The telemetry enable/disable commands correctly loaded config via
loadTelemetryConfig() (which honors the --config flag) but then
hardcoded the save path to config.GetConfigPath(cfg.DataDir), so
`mcpproxy --config /custom.json telemetry disable` always wrote to
~/.mcpproxy/mcp_config.json instead of the custom path. This is a
pre-existing bug introduced in PR #345 (Spec 036), not Spec 042.

Add a small telemetryConfigSavePath helper that mirrors the load
logic: prefer the package-level configFile flag when set, else fall
back to GetConfigPath(DataDir). Apply it to runTelemetryEnable,
runTelemetryDisable, and runTelemetryShowPayload (the latter passes
the path to telemetry.New which persists the anonymous ID). Adds
regression tests covering both enable and disable, plus a direct
helper unit test, with HOME sandboxed to t.TempDir() so accidental
writes to the real home config are detected.

Co-authored-by: Claude Code <noreply@anthropic.com>
D
Dumbris committed
bbd2a473ddd13b9c37c1dc18d16c828075d5c44b
Parent: f0c171f
Committed by GitHub <noreply@github.com> on 4/11/2026, 5:41:07 AM