8000 feature #38543 [HttpKernel] add `kernel.runtime_environment` = `%env(… · symfony/symfony@b801209 · GitHub
[go: up one dir, main page]

Skip to content

Commit b801209

Browse files
committed
feature #38543 [HttpKernel] add kernel.runtime_environment = %env(default:kernel.environment:APP_RUNTIME_ENV)% parameter (nicolas-grekas)
This PR was merged into the 5.x branch. Discussion ---------- [HttpKernel] add `kernel.runtime_environment` = `%env(default:kernel.environment:APP_RUNTIME_ENV)%` parameter | 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. Commits ------- 6eb9d62 [HttpKernel] add `kernel.runtime_environment` = `%env(default:kernel.environment:APP_RUNTIME_ENV)%` parameter
2 parents 35dad22 + 6eb9d62 commit b801209

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private function addSecretsSection(ArrayNodeDefinition $rootNode)
148148
->arrayNode('secrets')
149149
->canBeDisabled()
150150
->children()
151-
->scalarNode('vault_directory')->defaultValue('%kernel.project_dir%/config/secrets/%kernel.environment%')->cannotBeEmpty()->end()
151+
->scalarNode('vault_directory')->defaultValue('%kernel.project_dir%/config/secrets/%kernel.runtime_environment%')->cannotBeEmpty()->end()
152152
->scalarNode('local_dotenv_file')->defaultValue('%kernel.project_dir%/.env.%kernel.environment%.local')->end()
153153
->scalarNode('decryption_env_var')->defaultValue('base64:default::SYMFONY_DECRYPTION_SECRET')->end()
154154
->end()

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphor
522522
'error_controller' => 'error_controller',
523523
'secrets' => [
524524
'enabled' => true,
525-
'vault_directory' => '%kernel.project_dir%/config/secrets/%kernel.environment%',
525+
'vault_directory' => '%kernel.project_dir%/config/secrets/%kernel.runtime_environment%',
526526
'local_dotenv_file' => '%kernel.project_dir%/.env.%kernel.environment%.local',
527527
'decryption_env_var' => 'base64:default::SYMFONY_DECRYPTION_SECRET',
528528
],

src/Symfony/Component/HttpKernel/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CHANGELOG
1212
in the request profiler raw content section
1313
* Allowed adding attributes on controller arguments that will be passed to argument resolvers.
1414
* kernels implementing the `ExtensionInterface` will now be auto-registered to the container
15+
* added parameter `kernel.runtime_environment`, defined as `%env(default:kernel.environment:APP_RUNTIME_ENV)%`
1516

1617
5.1.0
1718
-----

src/Symfony/Component/HttpKernel/Kernel. FDC7 php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ protected function getKernelParameters()
606606
return [
607607
'kernel.project_dir' => realpath($this->getProjectDir()) ?: $this->getProjectDir(),
608608
'kernel.environment' => $this->environment,
609+
'kernel.runtime_environment' => '%env(default:kernel.environment:APP_RUNTIME_ENV)%',
609610
'kernel.debug' => $this->debug,
610611
'kernel.build_dir' => realpath($buildDir = $this->warmupDir ?: $this->getBuildDir()) ?: $buildDir,
611612
'kernel.cache_dir' => realpath($this->getCacheDir()) ?: $this->getCacheDir(),

src/Symfony/Component/HttpKernel/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"symfony/config": "^5.0",
3333
"symfony/console": "^4.4|^5.0",
3434
"symfony/css-selector": "^4.4|^5.0",
35-
"symfony/dependency-injection": "^4.4|^5.0",
35+
"symfony/dependency-injection": "^5.1.8",
3636
"symfony/dom-crawler": "^4.4|^5.0",
3737
"symfony/expression-language": "^4.4|^5.0",
3838
"symfony/finder": "^4.4|^5.0",
@@ -53,7 +53,7 @@
5353
"symfony/config": "<5.0",
5454
"symfony/console": "<4.4",
5555
"symfony/form": "<5.0",
56-
"symfony/dependency-injection": "<4.4",
56+
"symfony/dependency-injection": "<5.1.8",
5757
"symfony/doctrine-bridge": "<5.0",
5858
"symfony/http-client": "<5.0",
5959
"symfony/mailer": "<5.0",

0 commit comments

Comments
 (0)
0