mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-14 04:00:57 +03:00
Updated DeprecatedConfigParser to remove the secret key
This commit is contained in:
parent
16d9c3b93f
commit
d205405dcc
2 changed files with 25 additions and 1 deletions
|
@ -10,7 +10,7 @@ class DeprecatedConfigParser
|
|||
{
|
||||
public function __invoke(array $config): array
|
||||
{
|
||||
return compose([$this, 'parseNotFoundRedirect'])($config);
|
||||
return compose([$this, 'parseNotFoundRedirect'], [$this, 'removeSecretKey'])($config);
|
||||
}
|
||||
|
||||
public function parseNotFoundRedirect(array $config): array
|
||||
|
@ -30,4 +30,11 @@ class DeprecatedConfigParser
|
|||
|
||||
return $config;
|
||||
}
|
||||
|
||||
public function removeSecretKey(array $config): array
|
||||
{
|
||||
// Removing secret_key from any generated config will prevent the AppOptions object from crashing
|
||||
unset($config['app_options']['secret_key']);
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,4 +91,21 @@ class DeprecatedConfigParserTest extends TestCase
|
|||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function removesTheOldSecretKey(): void
|
||||
{
|
||||
$config = [
|
||||
'app_options' => [
|
||||
'secret_key' => 'foobar',
|
||||
],
|
||||
];
|
||||
$expected = [
|
||||
'app_options' => [],
|
||||
];
|
||||
|
||||
$result = ($this->postProcessor)($config);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue