Skip to content

Commit

Permalink
Move secret under node webhook in configuration (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Nov 27, 2023
1 parent d0bf295 commit b33d29e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<tag name="controller.service_arguments"/>
<argument type="service" id="monolog.logger.webgriffe_sylius_akeneo_plugin" />
<argument type="service" id="webgriffe_sylius_akeneo.command_bus" />
<argument type="string">%webgriffe_sylius_akeneo.webhook_secret%</argument>
<argument type="string">%webgriffe_sylius_akeneo.webhook.secret%</argument>
<call method="setContainer">
<argument type="service" id="service_container" />
</call>
Expand Down
6 changes: 5 additions & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
->end()

->scalarNode('webhook_secret')
->arrayNode('webhook')
->addDefaultsIfNotSet()
->children()
->scalarNode('secret')->isRequired()->cannotBeEmpty()->defaultNull()->end()
->end()
->end()

->arrayNode('value_handlers')
Expand Down
6 changes: 3 additions & 3 deletions src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function load(array $configs, ContainerBuilder $container): void
$this->registerResources('webgriffe_sylius_akeneo', 'doctrine/orm', $config['resources'], $container);

$this->registerApiClientParameters($config['api_client'], $container);
$this->registerWebhookParameters($config['webhook_secret'], $container);
$this->registerWebhookParameters($config['webhook'], $container);

Check failure on line 125 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:125:42: MixedArgument: Argument 1 of Webgriffe\SyliusAkeneoPlugin\DependencyInjection\WebgriffeSyliusAkeneoExtension::registerWebhookParameters cannot be mixed, expecting array<array-key, mixed> (see https://psalm.dev/030)

Check failure on line 125 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.3, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:125:42: MixedArgument: Argument 1 of Webgriffe\SyliusAkeneoPlugin\DependencyInjection\WebgriffeSyliusAkeneoExtension::registerWebhookParameters cannot be mixed, expecting array<array-key, mixed> (see https://psalm.dev/030)

Check failure on line 125 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:125:42: MixedArgument: Argument 1 of Webgriffe\SyliusAkeneoPlugin\DependencyInjection\WebgriffeSyliusAkeneoExtension::registerWebhookParameters cannot be mixed, expecting array<array-key, mixed> (see https://psalm.dev/030)

Check failure on line 125 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.3, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:125:42: MixedArgument: Argument 1 of Webgriffe\SyliusAkeneoPlugin\DependencyInjection\WebgriffeSyliusAkeneoExtension::registerWebhookParameters cannot be mixed, expecting array<array-key, mixed> (see https://psalm.dev/030)

Check failure on line 125 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:125:42: MixedArgument: Argument 1 of Webgriffe\SyliusAkeneoPlugin\DependencyInjection\WebgriffeSyliusAkeneoExtension::registerWebhookParameters cannot be mixed, expecting array<array-key, mixed> (see https://psalm.dev/030)

Check failure on line 125 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:125:42: MixedArgument: Argument 1 of Webgriffe\SyliusAkeneoPlugin\DependencyInjection\WebgriffeSyliusAkeneoExtension::registerWebhookParameters cannot be mixed, expecting array<array-key, mixed> (see https://psalm.dev/030)

Check failure on line 125 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.3, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:125:42: MixedArgument: Argument 1 of Webgriffe\SyliusAkeneoPlugin\DependencyInjection\WebgriffeSyliusAkeneoExtension::registerWebhookParameters cannot be mixed, expecting array<array-key, mixed> (see https://psalm.dev/030)

Check failure on line 125 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.3, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:125:42: MixedArgument: Argument 1 of Webgriffe\SyliusAkeneoPlugin\DependencyInjection\WebgriffeSyliusAkeneoExtension::registerWebhookParameters cannot be mixed, expecting array<array-key, mixed> (see https://psalm.dev/030)

$loader->load('services.xml');

Expand Down Expand Up @@ -254,8 +254,8 @@ private function registerTemporaryDirectoryParameter(ContainerBuilder $container
$container->setParameter($parameterKey, sys_get_temp_dir());
}

private function registerWebhookParameters(string $webhookSecret, ContainerBuilder $container): void
private function registerWebhookParameters(array $webhook, ContainerBuilder $container): void
{
$container->setParameter('webgriffe_sylius_akeneo.webhook_secret', $webhookSecret);
$container->setParameter('webgriffe_sylius_akeneo.webhook.secret', $webhook['secret']);

Check failure on line 259 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:259:76: MixedArgument: Argument 2 of Symfony\Component\DependencyInjection\ContainerBuilder::setParameter cannot be mixed, expecting UnitEnum|array<array-key, mixed>|null|scalar (see https://psalm.dev/030)

Check failure on line 259 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.3, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:259:76: MixedArgument: Argument 2 of Symfony\Component\DependencyInjection\ContainerBuilder::setParameter cannot be mixed, expecting UnitEnum|array<array-key, mixed>|null|scalar (see https://psalm.dev/030)

Check failure on line 259 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:259:76: MixedArgument: Argument 2 of Symfony\Component\DependencyInjection\ContainerBuilder::setParameter cannot be mixed, expecting UnitEnum|array<array-key, mixed>|null|scalar (see https://psalm.dev/030)

Check failure on line 259 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.3, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:259:76: MixedArgument: Argument 2 of Symfony\Component\DependencyInjection\ContainerBuilder::setParameter cannot be mixed, expecting UnitEnum|array<array-key, mixed>|null|scalar (see https://psalm.dev/030)

Check failure on line 259 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:259:76: MixedArgument: Argument 2 of Symfony\Component\DependencyInjection\ContainerBuilder::setParameter cannot be mixed, expecting UnitEnum|array<array-key, mixed>|null|scalar (see https://psalm.dev/030)

Check failure on line 259 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:259:76: MixedArgument: Argument 2 of Symfony\Component\DependencyInjection\ContainerBuilder::setParameter cannot be mixed, expecting UnitEnum|array<array-key, mixed>|null|scalar (see https://psalm.dev/030)

Check failure on line 259 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.3, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:259:76: MixedArgument: Argument 2 of Symfony\Component\DependencyInjection\ContainerBuilder::setParameter cannot be mixed, expecting UnitEnum|array<array-key, mixed>|null|scalar (see https://psalm.dev/030)

Check failure on line 259 in src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.3, MySQL 8.0

MixedArgument

src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php:259:76: MixedArgument: Argument 2 of Symfony\Component\DependencyInjection\ContainerBuilder::setParameter cannot be mixed, expecting UnitEnum|array<array-key, mixed>|null|scalar (see https://psalm.dev/030)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ webgriffe_sylius_akeneo:
password: '%env(WEBGRIFFE_SYLIUS_AKENEO_PLUGIN_PASSWORD)%'
client_id: '%env(WEBGRIFFE_SYLIUS_AKENEO_PLUGIN_CLIENT_ID)%'
secret: '%env(WEBGRIFFE_SYLIUS_AKENEO_PLUGIN_SECRET)%'

webhook_secret: '%env(WEBGRIFFE_SYLIUS_AKENEO_PLUGIN_WEBHOOK_SECRET)%'


webhook:
secret: '%env(WEBGRIFFE_SYLIUS_AKENEO_PLUGIN_WEBHOOK_SECRET)%'

value_handlers:
product:
attribute:
Expand Down

0 comments on commit b33d29e

Please sign in to comment.