Repository navigation
Hotfix 1.2.5: fix app:apikeys:add on bind-mounted .env.local - #67
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.5: make
app:apikeys:addwork on prod, where.env.localis a single-file bind mount.Changes
rename(.env.local.temp, .env.local)with an in-place write (copy()), followed by a read-back check. If the write fails or the content doesn't match,.env.localis restored from.env.local.backup(or removed if it didn't exist before) and the command fails.chmod()on the temp file: writing in place keeps the file's owner and mode..env.localkeeps its inode, so a return torename()fails the suite.Why
docker-compose.server.prod.ymlmounts../../shared/.env.local:/app/.env.local. That makes.env.locala mount point inside the container, andrename()can't replace it:Reproduced with
itkdev/php8.4-fpmand the same mount layout. With the fix,bin/console app:apikeys:add prod_test -nupdates the host-side shared file and leaves no temp or backup behind.Trade-off: the write is no longer atomic, so a request that reads
.env.localmid-write could briefly see a partial file. The backup and read-back check still prevent losing keys.