8000 [FrameworkBundle][Secrets] Hook configured local dotenv file by fancyweb · Pull Request #34922 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle][Secrets] Hook configured local dotenv file #34922

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[FrameworkBundle][Secrets] Hook configured local dotenv file
  • Loading branch information
fancyweb authored and nicolas-grekas committed Dec 13, 2019
commit 56f542c36bd7d3204139978c9e530895f1ac8167
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private function addSecretsSection(ArrayNodeDefinition $rootNode)
->canBeDisabled()
->children()
->scalarNode('vault_directory')->defaultValue('%kernel.project_dir%/config/secrets/%kernel.environment%')->cannotBeEmpty()->end()
->scalarNode('local_dotenv_file')->defaultValue('%kernel.project_dir%/.env.local')->end()
->scalarNode('local_dotenv_file')->defaultValue('%kernel.project_dir%/.env.%kernel.environment%.local')->end()
->scalarNode('decryption_env_var')->defaultValue('base64:default::SYMFONY_DECRYPTION_SECRET')->end()
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,9 @@ private function registerSecretsConfiguration(array $config, ContainerBuilder $c

$container->getDefinition('secrets.vault')->replaceArgument(0, $config['vault_directory']);

if (!$config['local_dotenv_file']) {
if ($config['local_dotenv_file']) {
$container->getDefinition('secrets.local_vault')->replaceArgument(0, $config['local_dotenv_file']);
} else {
$container->removeDefinition('secrets.local_vault');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<services>
<service id="secrets.vault" class="Symfony\Bundle\FrameworkBundle\Secrets\SodiumVault">
<tag name="container.env_var_loader" />
<argument>%kernel.project_dir%/config/secrets/%kernel.environment%</argument>
<argument>%env(base64:default::SYMFONY_DECRYPTION_SECRET)%</argument>
<argument />
<argument />
</service>

<service id="secrets.local_vault" class="Symfony\Bundle\FrameworkBundle\Secrets\DotenvVault">
<argument>%kernel.project_dir%/.env.local</argument>
<argument />
</service>
</services>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphor
'secrets' => [
'enabled' => true,
'vault_directory' => '%kernel.project_dir%/config/secrets/%kernel.environment%',
'local_dotenv_file' => '%kernel.project_dir%/.env.local',
'local_dotenv_file' => '%kernel.project_dir%/.env.%kernel.environment%.local',
'decryption_env_var' => 'base64:default::SYMFONY_DECRYPTION_SECRET',
],
];
Expand Down
0