Skip to content

Commit

Permalink
feat(env-var): Deprecate EnvVarEncryptedProcessor service and Encrypt…
Browse files Browse the repository at this point in the history
…Command command
  • Loading branch information
amirsgh committed Jul 3, 2020
1 parent ad86f0b commit a2db82a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
master
------

* Deprecate EnvVarEncryptedProcessor and EncryptCommand
* Improve message in case of encryption error
* Add command to encrypt secrets
* Drop support for PHP 7.1
Expand Down
8 changes: 8 additions & 0 deletions Command/EncryptCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

@trigger_error(
'The '.__NAMESPACE__.'\EncryptCommand class is deprecated, use symfony secrets management commands instead',
E_USER_DEPRECATED
);

/**
* Class EncryptCommand
*
* @author Christian Kollross <christian.kollross@ekino.com>
*
* @deprecated use symfony secrets management commands instead.
* @see https://github.com/symfony/symfony/pull/33997
*/
final class EncryptCommand extends Command
{
Expand Down
6 changes: 6 additions & 0 deletions DependencyInjection/EkinoDataProtectionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,17 @@ private function configureEncryptor(array $config, ContainerBuilder $container):
}

/**
* @deprecated
* @param array $config
* @param ContainerBuilder $container
*/
private function configureEncryptCommand(array $config, ContainerBuilder $container): void
{
@trigger_error(
'The '.__METHOD__.' method is deprecated command will be removed, use symfony secret management commands instead.',
E_USER_DEPRECATED
);

$container
->findDefinition('ekino_data_protection.command.encryptor')
->replaceArgument(0, $config['method'])
Expand Down
8 changes: 8 additions & 0 deletions DependencyInjection/EnvVarEncryptedProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;

@trigger_error(
'The '.__NAMESPACE__.'\EnvVarEncryptedProcessor class is deprecated, use symfony secrets management instead',
E_USER_DEPRECATED
);

/**
* @author Rémi Marseille <remi.marseille@ekino.com>
*
* @deprecated use symfony secrets instead.
* @see https://github.com/symfony/symfony/pull/33997
*/
final class EnvVarEncryptedProcessor implements EnvVarProcessorInterface
{
Expand Down
2 changes: 2 additions & 0 deletions Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
<argument />
<argument />
<tag name="console.command" command="ekino-data-protection:encrypt"/>
<deprecated>The "%service_id%" service is deprecated, use symfony secrets management commands instead</deprecated>
</service>

<service id="ekino_data_protection.dependency_injection.env_var_encrypted_processor" class="Ekino\DataProtectionBundle\DependencyInjection\EnvVarEncryptedProcessor" public="false">
<argument type="service" id="ekino_data_protection.encryptor" />

<tag name="container.env_var_processor" />
<deprecated>The "%service_id%" service is deprecated, use symfony secrets management instead</deprecated>
</service>

<service id="ekino_data_protection.monolog.processor.gdpr" class="Ekino\DataProtectionBundle\Monolog\Processor\GdprProcessor" public="false">
Expand Down
7 changes: 7 additions & 0 deletions Tests/Command/EncryptCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

@trigger_error(
'The '.__NAMESPACE__.'\EncryptCommandTest class is deprecated since command is deprecated',
E_USER_DEPRECATED
);

/**
* Class EncryptCommandTest
*
* @author Christian Kollross <christian.kollross@ekino.com>
*
* @deprecated since EncryptCommand class is deprecated.
*/
class EncryptCommandTest extends TestCase
{
Expand Down

0 comments on commit a2db82a

Please sign in to comment.