Skip to content

Commit 29e8c20

Browse files
committed
Reword with simpler example
1 parent 441939f commit 29e8c20

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

configuration.rst

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -485,48 +485,44 @@ You can reference environment variables using the special syntax
485485
``%env(ENV_VAR_NAME)%``. The values of these options are resolved at runtime
486486
(only once per request, to not impact performance).
487487

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

490490
.. configuration-block::
491491

492492
.. code-block:: yaml
493493
494-
# config/packages/doctrine.yaml
495-
doctrine:
496-
dbal:
497-
# by convention the env var names are always uppercase
498-
url: '%env(DATABASE_URL)%'
494+
# config/packages/framework.yaml
495+
framework:
496+
# by convention the env var names are always uppercase
497+
secret: '%env(APP_SECRET)%'
499498
# ...
500499
501500
.. code-block:: xml
502501
503-
<!-- config/packages/doctrine.xml -->
502+
<!-- config/packages/framework.xml -->
504503
<?xml version="1.0" encoding="UTF-8" ?>
505504
<container xmlns="http://symfony.com/schema/dic/services"
506505
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
507-
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
508506
xsi:schemaLocation="http://symfony.com/schema/dic/services
509-
https://symfony.com/schema/dic/services/services-1.0.xsd
510-
http://symfony.com/schema/dic/doctrine
511-
https://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
507+
https://symfony.com/schema/dic/services/services-1.0.xsd>
512508
513-
<doctrine:config>
509+
<framework:config>
514510
<!-- by convention the env var names are always uppercase -->
515-
<doctrine:dbal url="%env(resolve:DATABASE_URL)%"/>
516-
</doctrine:config>
511+
<framework:secret url="%env(APP_SECRET)%"/>
512+
</framework:config>
517513
518514
</container>
519515
520516
.. code-block:: php
521517
522-
// config/packages/doctrine.php
518+
// config/packages/framework.php
523519
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
524520
525521
return static function (ContainerConfigurator $container) {
526-
$container->extension('doctrine', [
527-
'dbal' => [
522+
$container->extension('framework', [
523+
'secret' => [
528524
// by convention the env var names are always uppercase
529-
'url' => '%env(resolve:DATABASE_URL)%',
525+
'url' => '%env(APP_SECRET)%',
530526
],
531527
]);
532528
};

configuration/env_var_processors.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Symfony provides the following env var processors:
6464
6565
# config/packages/framework.yaml
6666
parameters:
67-
env(SECRET): 'some_secret'
67+
env(APP_SECRET): 'some_secret'
6868
framework:
6969
secret: '%env(string:SECRET)%'
7070
@@ -81,7 +81,7 @@ Symfony provides the following env var processors:
8181
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8282
8383
<parameters>
84-
<parameter key="env(SECRET)">some_secret</parameter>
84+
<parameter key="env(APP_SECRET)">some_secret</parameter>
8585
</parameters>
8686
8787
<framework:config secret="%env(string:SECRET)%"/>
@@ -90,7 +90,7 @@ Symfony provides the following env var processors:
9090
.. code-block:: php
9191
9292
// config/packages/framework.php
93-
$container->setParameter('env(SECRET)', 'some_secret');
93+
$container->setParameter('env(APP_SECRET)', 'some_secret');
9494
$container->loadFromExtension('framework', [
9595
'secret' => '%env(string:SECRET)%',
9696
]);

0 commit comments

Comments
 (0)