Skip to content

[9.x] Allow to pass base64 key to env:encrypt command - #45157

Merged
taylorotwell merged 3 commits into
laravel:9.xfrom
ekateiva:feature/fix-env-encrypt-with-base64-key
Dec 1, 2022
Merged

taylorotwell merged 3 commits into
laravel:9.xfrom
ekateiva:feature/fix-env-encrypt-with-base64-key

Conversation

@ekateiva

@ekateiva ekateiva commented Dec 1, 2022

Copy link
Copy Markdown
Contributor

The idea is described in #45155

The thing is that it is not possible now to reuse automatically generated base64 key by env:encrypt (when --key option is not passed) for further encryptions of .env file:

php artisan env:encrypt --env=staging --force --key=base64:74yqwbohnT2S9UFILYaDv73lZTqiDBeUDvyWHT6V0pw=
>    ERROR  Unsupported cipher or incorrect key length. Supported ciphers are: aes-128-cbc, aes-256-cbc, aes-128-gcm, aes-256-gcm.

And you would like to reuse the same encryption key between developers working on the same project and who needs to modify the .env (e.g. staging, production, etc.) files.

Fixes #45155

@driesvints
driesvints requested a review from joedixon December 1, 2022 10:05
@joedixon

joedixon commented Dec 1, 2022

Copy link
Copy Markdown
Contributor

Thanks @ekateiva, this is a really nice addition and something I've been considering for a while.

I just simplified the PR a little - let me know if you have any feedback.

@ekateiva

ekateiva commented Dec 1, 2022

Copy link
Copy Markdown
Contributor Author

@joedixon Thanks for simplifying it... Looks good to me! 👍

@taylorotwell
taylorotwell merged commit eb19ed8 into laravel:9.x Dec 1, 2022
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.

env:encrypt command can not deal with default base64 key

3 participants