Skip to content

Commit b15ca74

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

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)