Skip to content

feat: add /admin/config/check route to compare env vs Redis config values#1042

Merged
nledez merged 3 commits intocgwire:mainfrom
nledez:admin-check-route
Mar 26, 2026
Merged

feat: add /admin/config/check route to compare env vs Redis config values#1042
nledez merged 3 commits intocgwire:mainfrom
nledez:admin-check-route

Conversation

@nledez
Copy link
Copy Markdown
Contributor

@nledez nledez commented Mar 25, 2026

Problem
There was no way to diagnose discrepancies between config values set in environment variables and those stored in Redis (e.g. USER_LIMIT showing different values depending on
which source was read). This made it difficult to troubleshoot configuration sync issues across app, worker, and CLI processes.

Solution

  • New admin blueprint with token-based auth (ADMIN_TOKEN env var)
  • Route only registered when ADMIN_TOKEN is set
  • Compares env and Redis values for all config_store managed keys (user_limit, default_timezone, default_locale, nomad_*)
  • Includes active (non-bot) user count
  • Add _get_redis_raw() and get_config_comparison() to config_store
  • Add 8 tests covering auth (403 cases) and response validation

nledez added 3 commits March 25, 2026 23:06
…lues

  - New admin blueprint with token-based auth (ADMIN_TOKEN env var)
  - Route only registered when ADMIN_TOKEN is set
  - Compares env and Redis values for all config_store managed keys
  (user_limit, default_timezone, default_locale, nomad_*)
  - Includes active (non-bot) user count
  - Add _get_redis_raw() and get_config_comparison() to config_store
  - Add 8 tests covering auth (403 cases) and response validation
  Compare env-cli, redis, and env-api values side by side.
  The check verifies env-cli == redis and exits with code 1 on mismatch,
  making it usable in monitoring scripts.

  - Add ENV_VAR_MAP to read env vars on the CLI side
  - Show ✗ and "out of sync" message when env-cli diverges from redis
  - Command only registered when ADMIN_TOKEN is set
  - Tests use unittest.TestCase with mocked requests (no DB needed)
@nledez nledez merged commit 295a0ce into cgwire:main Mar 26, 2026
16 checks passed
@nledez nledez deleted the admin-check-route branch March 26, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant