Skip to content

Commit 4bd105a

Browse files
committed
minor #17871 [Config] Simplify configuration env var example (94noni)
This PR was merged into the 5.4 branch. Discussion ---------- [Config] Simplify configuration env var example Hi, This PR supersede [this one](#16575) ``` Simplify here as the `resolve` is not needed, as reference it is documented in the dedicated doc page here https://symfony.com/doc/current/configuration/env_var_processors.html ``` [Targeting](#16575 (comment)) v5.4 instead of v4.4 friendly ping `@GromNaN` `@javiereguiluz` `@HeahDude` `@nicolas`-grekas as original reviewers Commits ------- b15ca74 Simplify configuration env var example
2 parents a2f8e23 + b15ca74 commit 4bd105a

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

configuration.rst

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -605,51 +605,42 @@ The values of these options are resolved at runtime (only once per request, to
605605
not impact performance) so you can change the application behavior without having
606606
to clear the cache.
607607

608-
This example shows how you could configure the database connection using an env var:
608+
This example shows how you could configure the application secret using an env var:
609609

610610
.. configuration-block::
611611

612612
.. code-block:: yaml
613613
614-
# config/packages/doctrine.yaml
615-
doctrine:
616-
dbal:
617-
# by convention the env var names are always uppercase
618-
url: '%env(resolve:DATABASE_URL)%'
614+
# config/packages/framework.yaml
615+
framework:
616+
# by convention the env var names are always uppercase
617+
secret: '%env(APP_SECRET)%'
619618
# ...
620619
621620
.. code-block:: xml
622621
623-
<!-- config/packages/doctrine.xml -->
622+
<!-- config/packages/framework.xml -->
624623
<?xml version="1.0" encoding="UTF-8" ?>
625624
<container xmlns="http://symfony.com/schema/dic/services"
626625
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
627-
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
626+
xmlns:framework="http://symfony.com/schema/dic/framework"
628627
xsi:schemaLocation="http://symfony.com/schema/dic/services
629628
https://symfony.com/schema/dic/services/services-1.0.xsd
630-
http://symfony.com/schema/dic/doctrine
631-
https://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
629+
http://symfony.com/schema/dic/symfony
630+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
632631
633-
<doctrine:config>
634-
<!-- by convention the env var names are always uppercase -->
635-
<doctrine:dbal url="%env(resolve:DATABASE_URL)%"/>
636-
</doctrine:config>
632+
<framework:config secret="%env(APP_SECRET)%"/>
637633
638634
</container>
639635
640636
.. code-block:: php
641637
642-
// config/packages/doctrine.php
638+
// config/packages/framework.php
643639
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
644640
645641
return static function (ContainerConfigurator $containerConfigurator) {
646-
$containerConfigurator->extension('doctrine', [
647-
'dbal' => [
648-
// by convention the env var names are always uppercase
649-
'url' => env('DATABASE_URL')->resolve(),
650-
// or
651-
'url' => '%env(resolve:DATABASE_URL)%',
652-
],
642+
$container->extension('framework', [
643+
'secret' => '%env(APP_SECRET)%',
653644
]);
654645
};
655646

0 commit comments

Comments
 (0)