Skip to content

Commit ebd42b1

Browse files
Merge branch '6.4' into 7.3
* 6.4: [FrameworkBundle] Fix secrets:encrypt-from-local Update regular expression in URL validator
2 parents 9a234e0 + ee58c2a commit ebd42b1

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Command/SecretsEncryptFromLocalCommand.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5757
}
5858

5959
foreach ($this->vault->list(true) as $name => $value) {
60-
$localValue = $this->localVault->reveal($name);
60+
if (null === $localValue = $this->localVault->reveal($name)) {
61+
continue;
62+
}
6163

62-
if (null !== $localValue && $value !== $localValue) {
64+
if ($value !== $localValue) {
6365
$this->vault->seal($name, $localValue);
64-
} elseif (null !== $message = $this->localVault->getLastMessage()) {
65-
$io->error($message);
66-
67-
return 1;
66+
$io->note($this->vault->getLastMessage());
6867
}
6968
}
7069

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private function addSecretsSection(ArrayNodeDefinition $rootNode): void
197197
->canBeDisabled()
198198
->children()
199199
->scalarNode('vault_directory')->defaultValue('%kernel.project_dir%/config/secrets/%kernel.runtime_environment%')->cannotBeEmpty()->end()
200-
->scalarNode('local_dotenv_file')->defaultValue('%kernel.project_dir%/.env.%kernel.environment%.local')->end()
200+
->scalarNode('local_dotenv_file')->defaultValue('%kernel.project_dir%/.env.%kernel.runtime_environment%.local')->end()
201201
->scalarNode('decryption_env_var')->defaultValue('base64:default::SYMFONY_DECRYPTION_SECRET')->end()
202202
->end()
203203
->end()

Tests/Command/SecretsEncryptFromLocalCommandTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function testDoesNotSealIfSameValue()
9292
$this->assertSame('same-value', $revealed);
9393
}
9494

95-
public function testFailsIfLocalSecretIsMissing()
95+
public function testStillSucceedsIfLocalSecretIsMissing()
9696
{
9797
$vault = new SodiumVault($this->vaultDir);
9898
$vault->generateKeys();
@@ -105,7 +105,8 @@ public function testFailsIfLocalSecretIsMissing()
105105
$command = new SecretsEncryptFromLocalCommand($vault, $localVault);
106106
$tester = new CommandTester($command);
107107

108-
$this->assertSame(1, $tester->execute([]));
109-
$this->assertStringContainsString('Secret "MISSING_IN_LOCAL" not found', $tester->getDisplay());
108+
$this->assertSame(0, $tester->execute([]));
109+
$revealed = $vault->reveal('MISSING_IN_LOCAL');
110+
$this->assertSame('prod-only', $revealed);
110111
}
111112
}

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphor
976976
'secrets' => [
977977
'enabled' => true,
978978
'vault_directory' => '%kernel.project_dir%/config/secrets/%kernel.runtime_environment%',
979-
'local_dotenv_file' => '%kernel.project_dir%/.env.%kernel.environment%.local',
979+
'local_dotenv_file' => '%kernel.project_dir%/.env.%kernel.runtime_environment%.local',
980980
'decryption_env_var' => 'base64:default::SYMFONY_DECRYPTION_SECRET',
981981
],
982982
'http_cache' => [

0 commit comments

Comments
 (0)