Skip to content

Commit 416f886

Browse files
committed
Simplify configuration env var example
1 parent cd6140a commit 416f886

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

configuration.rst

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -605,51 +605,43 @@ 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:
614+
# config/packages/framework.yaml
615+
framework:
616616
dbal:
617617
# by convention the env var names are always uppercase
618-
url: '%env(resolve:DATABASE_URL)%'
618+
secret: '%env(APP_SECRET)%'
619619
# ...
620620
621621
.. code-block:: xml
622622
623-
<!-- config/packages/doctrine.xml -->
623+
<!-- config/packages/framework.xml -->
624624
<?xml version="1.0" encoding="UTF-8" ?>
625625
<container xmlns="http://symfony.com/schema/dic/services"
626626
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
627-
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
627+
xmlns:framework="http://symfony.com/schema/dic/framework"
628628
xsi:schemaLocation="http://symfony.com/schema/dic/services
629629
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">
630+
http://symfony.com/schema/dic/symfony
631+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
632632
633-
<doctrine:config>
634-
<!-- by convention the env var names are always uppercase -->
635-
<doctrine:dbal url="%env(resolve:DATABASE_URL)%"/>
636-
</doctrine:config>
633+
<framework:config secret="%env(APP_SECRET)%"/>
637634
638635
</container>
639636
640637
.. code-block:: php
641638
642-
// config/packages/doctrine.php
639+
// config/packages/framework.php
643640
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
644641
645642
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-
],
643+
$container->extension('framework', [
644+
'secret' => '%env(APP_SECRET)%',
653645
]);
654646
};
655647

0 commit comments

Comments
 (0)