Skip to content

Commit 7b28f79

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 ------- 6eb9d62bdd [HttpKernel] add `kernel.runtime_environment` = `%env(default:kernel.environment:APP_RUNTIME_ENV)%` parameter
2 parents 51ebbdf + 43f1bef commit 7b28f79

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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()

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
],

0 commit comments

Comments
 (0)