Skip to content

Commit a2bc20f

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

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

configuration.rst

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -485,48 +485,45 @@ 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:
494+
# config/packages/framework.yaml
495+
framework:
496+
secret: '%env(string:SECRET)%'
497497
# by convention the env var names are always uppercase
498-
url: '%env(DATABASE_URL)%'
498+
secret: '%env(APP_SECRET)%'
499499
# ...
500500
501501
.. code-block:: xml
502502
503-
<!-- config/packages/doctrine.xml -->
503+
<!-- config/packages/framework.xml -->
504504
<?xml version="1.0" encoding="UTF-8" ?>
505505
<container xmlns="http://symfony.com/schema/dic/services"
506506
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
507-
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
508507
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">
508+
https://symfony.com/schema/dic/services/services-1.0.xsd>
512509
513-
<doctrine:config>
510+
<framework:config>
514511
<!-- by convention the env var names are always uppercase -->
515-
<doctrine:dbal url="%env(resolve:DATABASE_URL)%"/>
516-
</doctrine:config>
512+
<framework:secret url="%env(string:SECRET)%"/>
513+
</framework:config>
517514
518515
</container>
519516
520517
.. code-block:: php
521518
522-
// config/packages/doctrine.php
519+
// config/packages/framework.php
523520
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
524521
525522
return static function (ContainerConfigurator $container) {
526-
$container->extension('doctrine', [
527-
'dbal' => [
523+
$container->extension('framework', [
524+
'secret' => [
528525
// by convention the env var names are always uppercase
529-
'url' => '%env(resolve:DATABASE_URL)%',
526+
'url' => '%env(string:SECRET)%',
530527
],
531528
]);
532529
};

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)