Repository navigation
Hotfix 1.2.3: add app:apikeys:add command - #63
Merged
Merged
Conversation
|
✅ No changes detected in API specification |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hotfix 1.2.3: add an
app:apikeys:addconsole command that generates an API key for a user and writes it to.env.local.Changes
app:apikeys:add [<username>]command (src/Command/ApiKeysAddCommand.php):--no-interaction.APP_API_KEYSfrom.env.local(Symfony Dotenv parser, so the multi-line format from the README works) and refuses duplicate usernames.bin2hex(random_bytes(32)), rewrites only theAPP_API_KEYSline (or appends it), and prints the key..env.local.temp(exclusive create, so a leftover file or a concurrent run fails), reads it back and verifies the keys, then copies.env.localto.env.local.backupand atomically renames the temp file over.env.local. File permissions are preserved and.env.localis never touched if anything fails..env.local.backupexists, or if.env.localis a symlink..env.local.phpexists, warns thatcomposer dump-env prodmust be run for the key to take effect, plus an extra warning when itsAPP_API_KEYSdiffers from.env.local. It only advises; it never runs the dump.tests/Command/ApiKeysAddCommandTest.php..gitignoreentries for.env.local.tempand.env.local.backup.Why
There is no self-service registration, so API keys are hand-written JSON in
.env.local. The command removes the manual editing and key generation.ApiUserProvider, the authenticator and the config are unchanged, and%env()%is resolved at runtime, so a new key works on the next request without a cache clear.Targets
mainas a gitflow hotfix so it can ship ahead of Release 1.3.0 (#62). It only adds new files, so merging back todevelopshould conflict only inCHANGELOG.md.