8000 [Configuration] Simplified how default env vars are defined · symfony/symfony-docs@9448323 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9448323

Browse files
committed
[Configuration] Simplified how default env vars are defined
1 parent 08526cf commit 9448323

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

configuration.rst

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -407,33 +407,12 @@ This example shows how to configure the database connection using an env var:
407407
The next step is to define the value of those env vars in your shell, your web
408408
server, etc. This is explained in the following sections, but to protect your
409409
application from undefined env vars, you can give them a default value using the
410-
``parameters`` key:
410+
``.env`` file:
411411

412-
.. configuration-block::
413-
414-
.. code-block:: yaml
415-
416-
# config/services.yaml
417-
parameters:
418-
env(DATABASE_URL): 'sqlite:///%kernel.project_dir%/var/data.db'
419-
420-
.. code-block:: xml
421-
422-
<!-- config/services.xml -->
423-
<?xml version="1.0" encoding="UTF-8" ?>
424-
<container xmlns="http://symfony.com/schema/dic/services"
425-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
426-
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
427-
428-
<parameters>
429-
<parameter key="env(DATABASE_URL)">sqlite:///%kernel.project_dir%/var/data.db</parameter>
430-
</parameters>
431-
</container>
432-
433-
.. code-block:: php
412+
.. code-block:: bash
434413
435-
// config/services.php
436-
$container->setParameter('env(DATABASE_URL)', 'sqlite:///%kernel.project_dir%/var/data.db');
414+
# .env (or .env.local)
415+
DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db
437416
438417
.. seealso::
439418

0 commit comments

Comments
 (0)
0