Skip to content

[HttpKernel] add kernel.runtime_environment = %env(default:kernel.environment:APP_RUNTIME_ENV)% parameter #38543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2020

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Oct 13, 2020

Q A
Branch? 5.2
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

Instead of #37584

This PR adds a new kernel.runtime_environment parameter, which creates a convention to use the APP_RUNTIME_ENV env var to define the name of the runtime environment where the app is deployed.

When this env var is not set, the parameter defaults to kernel.environment.

This is especially useful for defining the location of the vault for secrets: an app can be deployed in "prod" mode, but still not be deployed on the real prod deployment target. When this happens, one might not use real prod secrets but instead, use a vault with creds for staging.

This parameter enables this use case.

@Koc
Copy link
Contributor

Koc commented Oct 13, 2020

Why not kernel.runtime_environment to be consistent in parameters naming?

@nicolas-grekas
Copy link
Member Author

Why not kernel.runtime_environment to be consistent in parameters naming?

Because it's shorter and equally descriptive to me.

Copy link
Member

@jderusse jderusse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another advantage: developers can use APP_RUNTIME_ENV=prod ./bin/console secret:set to define secret in "prod" environment without needing to build and boot a "prod" containers. It avoid booting tools like "newrelic", "sentry", ...

@nicolas-grekas nicolas-grekas changed the title [HttpKernel] add kernel.runtime_env = %env(default:kernel.environment:APP_RUNTIME_ENV)% parameter [HttpKernel] add kernel.runtime_environment = %env(default:kernel.environment:APP_RUNTIME_ENV)% parameter Oct 21, 2020
@fabpot
Copy link
Member

fabpot commented Oct 21, 2020

Thank you @nicolas-grekas.

@fabpot fabpot merged commit b801209 into symfony:5.x Oct 21, 2020
@nicolas-grekas nicolas-grekas deleted the hk-runtime-env branch October 21, 2020 13:23
@fabpot fabpot mentioned this pull request Oct 28, 2020
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Jul 27, 2021
This PR was merged into the 5.2 branch.

Discussion
----------

[secrets] Use APP_RUNTIME_ENV to define secrets

Use new env variable introduced in symfony/symfony#38543 to define secrets.

/cc `@nicolas`-grekas

Commits
-------

9994e7b Use APP_RUNTIME_ENV to define secrets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants