Skip to content

Add optional cipher argument to env:decrypt#195

Closed
joerucci wants to merge 2 commits intolaravel:2.0from
joerucci:feat/configurable-cipher
Closed

Add optional cipher argument to env:decrypt#195
joerucci wants to merge 2 commits intolaravel:2.0from
joerucci:feat/configurable-cipher

Conversation

@joerucci
Copy link

@joerucci joerucci commented Oct 3, 2025

Currently, Vapor always invokes env:decrypt with the default cipher. Some teams need to standardize on a specific cipher algorithm across deployments.

This PR updates the Environment class to optionally pass a --cipher argument to env:decrypt when VAPOR_ENV_ENCRYPTION_CIPHER is set.

  • No change in behavior when unset (backwards compatible).
  • Provides flexibility for teams that prefer AES-256-CBC or another supported cipher.
  • Makes it easier to align Vapor deployments with existing environment encryption workflows.

This change updates the Environment class to pass an optional
--cipher argument when invoking the `env:decrypt` command.

- Introduces a protected $cipher property, initialized from
  VAPOR_ENV_ENCRYPTION_CIPHER if set.
- When $cipher is not null, it is forwarded to the `env:decrypt`
  Artisan call.
- Keeps behavior unchanged when no cipher is provided, so the
  command falls back to its default behavior.

This allows teams to standardize on a specific cipher during
Vapor deployments while remaining fully backwards compatible.
@taylorotwell
Copy link
Member

I would recommend just using the default Laravel cipher.

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