diff --git a/README.md b/README.md index 106889e8221d329b2d3f26eb7751d403a9d8a683..b09525ad002d1bcfb059c3707a1bbc21af641f41 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,8 @@ content: ```yaml dbp_relay_template: - secret_token: 42 - # secret_token: '%env(SECRET_TOKEN)%' + example_config: 42 + # example_config: '%env(EXAMPLE_CONFIG)%' ``` The value gets read in `DbpRelayTemplateExtension` and passed when creating the diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 88070434b817b3aaff4ce6dbb700d0f0073df3d3..5506ae25e47a309b48ae4c6eec41cb820be535c9 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -15,7 +15,7 @@ class Configuration implements ConfigurationInterface $treeBuilder->getRootNode() ->children() - ->scalarNode('secret_token') + ->scalarNode('example_config') ->defaultValue('42') ->end() ->end(); diff --git a/src/DependencyInjection/DbpRelayTemplateExtension.php b/src/DependencyInjection/DbpRelayTemplateExtension.php index 2d55a11f96a86487eefefc4509b6525dae4700c5..93d457ad6534dda3793ac53de675a5235dfea1c6 100644 --- a/src/DependencyInjection/DbpRelayTemplateExtension.php +++ b/src/DependencyInjection/DbpRelayTemplateExtension.php @@ -24,7 +24,7 @@ class DbpRelayTemplateExtension extends ConfigurableExtension // Inject the config value into the MyCustomService service $definition = $container->getDefinition('Dbp\Relay\TemplateBundle\Service\MyCustomService'); - $definition->addArgument($mergedConfig['secret_token']); + $definition->addArgument($mergedConfig['example_config']); } private function extendArrayParameter(ContainerBuilder $container, string $parameter, array $values) diff --git a/src/Service/MyCustomService.php b/src/Service/MyCustomService.php index 783a71c31728812e051f7d44cdbc18be2fa8f83a..b1817b0ab465a40bb9d1694214cfc5cea8871a3e 100644 --- a/src/Service/MyCustomService.php +++ b/src/Service/MyCustomService.php @@ -6,10 +6,10 @@ namespace Dbp\Relay\TemplateBundle\Service; class MyCustomService { - private $token; + private $someConfig; - public function __construct(string $token) + public function __construct(string $someConfig) { - $this->token = $token; + $this->$someConfig = $someConfig; } } diff --git a/tests/Kernel.php b/tests/Kernel.php index 09c96dd87b6caaa1d40558a774881bf666829a34..a2aa1c745db071859e007c5d4370b4ab632abe32 100644 --- a/tests/Kernel.php +++ b/tests/Kernel.php @@ -48,7 +48,7 @@ class Kernel extends BaseKernel ]); $container->extension('dbp_relay_template', [ - 'secret_token' => 'secret-test', + 'example_config' => 'test-42', ]); } } diff --git a/tests/Service/ExternalApiTest.php b/tests/Service/ExternalApiTest.php index f1a85acc0f0a5452b9741a25212cd13e5bf44757..68211e5362fed06a718f1b468473170083261e6d 100644 --- a/tests/Service/ExternalApiTest.php +++ b/tests/Service/ExternalApiTest.php @@ -14,7 +14,7 @@ class ExternalApiTest extends WebTestCase protected function setUp(): void { - $service = new MyCustomService('secret-test-custom'); + $service = new MyCustomService('test-42'); $this->api = new ExternalApi($service); }