Add auto rotation of the license key provided KEYGEN_API_KEY.#4442
Conversation
📝 WalkthroughWalkthroughAdds Keygen license management: a new ChangesKeygen License Management
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 warning)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/specs/2-how-to/keygen-license-management.md (1)
1-63:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd required footer with last-updated date.
Documentation files must include a footer with an hr line and "Last updated: [date]" per coding guidelines. This provides clarity on documentation freshness and maintenance.
📝 Add footer to end of file
| Rotation never triggers | User logging in is not an admin | Only admin logins (`may_administrate = true`) trigger rotation | + +--- + +*Last updated: June 2026*Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bfb1a13d-4242-4588-a6cd-c5d43c990a67
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
.env.exampleapp/Actions/Diagnostics/Errors.phpapp/Actions/Diagnostics/Pipes/Checks/KeygenApiTokenCheck.phpapp/Actions/Diagnostics/Pipes/Checks/OldLicenseCheck.phpapp/Jobs/RotateLicenseKeyJob.phpapp/Listeners/RotateLicenseKeyOnLogin.phpapp/Providers/AppServiceProvider.phpapp/Providers/EventServiceProvider.phpdocs/specs/2-how-to/keygen-license-management.md
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 64de3236-3929-4482-ba56-6af51f23e3b0
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
app/Jobs/RotateLicenseKeyJob.phpapp/Listeners/RotateLicenseKeyOnLogin.phpdocker-compose.yamldocker/scripts/01-validate-env.sh
This pull request introduces automated license key rotation and API token health checks for Lychee's Keygen-based license management. When an admin logs in, Lychee can now automatically rotate an expired license key using a configured Keygen API token, and administrators will see warnings or errors on the diagnostics page if the API token is invalid or near expiration. The changes include new diagnostics checks, a background job for key rotation, event listener integration, and updated documentation.
Keygen License Management Integration:
KEYGEN_API_KEYin.envto enable automatic license key rotation and API token health checks. (.env.example)KeygenApiTokenCheck) to warn admins if the Keygen API token is invalid or expiring soon, and integrated it into the diagnostics pipeline. (app/Actions/Diagnostics/Pipes/Checks/KeygenApiTokenCheck.php, app/Actions/Diagnostics/Errors.php) [1] [2] [3]Automatic License Key Rotation:
RotateLicenseKeyJob) that attempts to rotate an expired license key using the Keygen API token, triggered after admin login or on diagnostics check. (app/Jobs/RotateLicenseKeyJob.php, app/Actions/Diagnostics/Pipes/Checks/OldLicenseCheck.php) [1] [2] [3] [4]RotateLicenseKeyOnLogin) and registered it to fire after admin logins, dispatching the rotation job. (app/Listeners/RotateLicenseKeyOnLogin.php, app/Providers/EventServiceProvider.php) [1] [2] [3]Documentation and Service Binding:
VerifyFactorybinding in the service provider to support the new license management workflow. (app/Providers/AppServiceProvider.php) [1] [2]Summary by CodeRabbit
KEYGEN_API_KEY, with optional secret support throughKEYGEN_API_KEY_FILE.