Skip to content

fix(backend): graceful shutdown and strict JWT/Redis env vars - #936

Merged
chinweobtagaz merged 1 commit into
OpenKnight-Foundation:mainfrom
Cedarich:fix/graceful-shutdown-and-strict-secrets
Jul 30, 2026
Merged

fix(backend): graceful shutdown and strict JWT/Redis env vars#936
chinweobtagaz merged 1 commit into
OpenKnight-Foundation:mainfrom
Cedarich:fix/graceful-shutdown-and-strict-secrets

Conversation

@Cedarich

Copy link
Copy Markdown
Contributor

Summary

Implements graceful shutdown for the Actix-Web server and removes unsafe hardcoded fallbacks for JWT and Redis configuration.

Changes

BE-26 — Graceful shutdown (backend/modules/api/src/server.rs)

  • Install SIGTERM / SIGINT handlers via tokio::signal::unix
  • On signal, call ServerHandle::stop(true) so in-flight requests and WebSocket connections complete and the worker thread pool drains
  • Documented from backend/src/main.rs

BE-27 — Strict secrets (backend/modules/security/src/jwt.rs, server.rs)

  • Add JwtService::from_env() requiring JWT_SECRET or JWT_SECRET_KEY (no fallback; panics on empty / known insecure defaults)
  • Require REDIS_URL via std::env::var(...).expect(...) (no localhost default)
  • Update .env.example to mark both as required

Acceptance criteria

  • SIGTERM/SIGINT trigger graceful drain of connections and workers
  • Missing JWT_SECRET / JWT_SECRET_KEY crashes on startup
  • Missing REDIS_URL crashes on startup
  • No hardcoded JWT or Redis fallbacks remain

Closes #934
Closes #935
Closes #932

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Cedarich Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@chinweobtagaz
chinweobtagaz merged commit 0d7fc66 into OpenKnight-Foundation:main Jul 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants