Skip to content

feat(moni): add API key rotation command#45

Merged
CodeMonkeyCybersecurity merged 2 commits intomainfrom
claude/api-key-management-script-011CUrCr7tXgZkrecW3LCZmP
Nov 13, 2025
Merged

feat(moni): add API key rotation command#45
CodeMonkeyCybersecurity merged 2 commits intomainfrom
claude/api-key-management-script-011CUrCr7tXgZkrecW3LCZmP

Conversation

@CodeMonkeyCybersecurity
Copy link
Owner

Implements 'eos update moni rotate-api-keys' command to rotate LiteLLM virtual keys for Moni/BionicGPT deployment.

Changes:

  • Added pkg/bionicgpt/rotate_api_keys.go with full rotation logic
  • Updated pkg/bionicgpt/types.go with rotation constants and types
  • Added rotate-api-keys subcommand to cmd/update/moni.go

Features:

  • ASSESS → INTERVENE → EVALUATE pattern implementation
  • Automatic .env backup before changes
  • Transaction-like behavior with rollback on failure
  • Generates new virtual key via LiteLLM API
  • Updates .env file (OPENAI_API_KEY, EMBEDDINGS_API_KEY)
  • Updates database models table with new key
  • Restarts app container to pick up changes
  • Comprehensive verification tests
  • Deletes old key after successful rotation

Safety:

  • Dry-run mode (--dry-run) to preview changes
  • Skip backup option (--skip-backup, not recommended)
  • Skip verification option (--skip-verify)
  • Skip restart option (--skip-restart)
  • Custom install directory (--install-dir)

Architecture compliance:

  • Business logic in pkg/, orchestration in cmd/
  • Structured logging throughout
  • No hardcoded values (all constants defined)
  • Error context with remediation steps
  • Uses execute package for Docker operations

Replaces manual bash script with integrated Eos command.

claude and others added 2 commits November 6, 2025 07:09
Implements 'eos update moni rotate-api-keys' command to rotate LiteLLM
virtual keys for Moni/BionicGPT deployment.

Changes:
- Added pkg/bionicgpt/rotate_api_keys.go with full rotation logic
- Updated pkg/bionicgpt/types.go with rotation constants and types
- Added rotate-api-keys subcommand to cmd/update/moni.go

Features:
- ASSESS → INTERVENE → EVALUATE pattern implementation
- Automatic .env backup before changes
- Transaction-like behavior with rollback on failure
- Generates new virtual key via LiteLLM API
- Updates .env file (OPENAI_API_KEY, EMBEDDINGS_API_KEY)
- Updates database models table with new key
- Restarts app container to pick up changes
- Comprehensive verification tests
- Deletes old key after successful rotation

Safety:
- Dry-run mode (--dry-run) to preview changes
- Skip backup option (--skip-backup, not recommended)
- Skip verification option (--skip-verify)
- Skip restart option (--skip-restart)
- Custom install directory (--install-dir)

Architecture compliance:
- Business logic in pkg/, orchestration in cmd/
- Structured logging throughout
- No hardcoded values (all constants defined)
- Error context with remediation steps
- Uses execute package for Docker operations

Replaces manual bash script with integrated Eos command.
…gZkrecW3LCZmP

Signed-off-by: cybermonkey <git@cybermonkey.net.au>
@CodeMonkeyCybersecurity CodeMonkeyCybersecurity merged commit 78dabf7 into main Nov 13, 2025
14 of 29 checks passed
@CodeMonkeyCybersecurity CodeMonkeyCybersecurity deleted the claude/api-key-management-script-011CUrCr7tXgZkrecW3LCZmP branch November 13, 2025 14:17
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.

2 participants