Skip to content

Commit 11870a3

Browse files
committed
minor #11795 Add example for env var processor: trim (jschaedl)
This PR was squashed before being merged into the 4.3 branch (closes #11795). Discussion ---------- Add example for env var processor: trim <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- ecd9e61 Add example for env var processor: trim
2 parents a2a39b2 + ecd9e61 commit 11870a3

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

configuration/env_var_processors.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,43 @@ Symfony provides the following env var processors:
376376
and end of the string. This is especially useful in combination with the
377377
``file`` processor, as it'll remove newlines at the end of a file.
378378

379+
.. configuration-block::
380+
381+
.. code-block:: yaml
382+
383+
# config/packages/framework.yaml
384+
parameters:
385+
env(AUTH_FILE): '../config/auth.json'
386+
google:
387+
auth: '%env(trim:file:AUTH_FILE)%'
388+
389+
.. code-block:: xml
390+
391+
<!-- config/packages/framework.xml -->
392+
<?xml version="1.0" encoding="UTF-8" ?>
393+
<container xmlns="http://symfony.com/schema/dic/services"
394+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
395+
xmlns:framework="http://symfony.com/schema/dic/symfony"
396+
xsi:schemaLocation="http://symfony.com/schema/dic/services
397+
https://symfony.com/schema/dic/services/services-1.0.xsd
398+
http://symfony.com/schema/dic/symfony
399+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
400+
401+
<parameters>
402+
<parameter key="env(AUTH_FILE)">../config/auth.json</parameter>
403+
</parameters>
404+
405+
<google auth="%env(trim:file:AUTH_FILE)%"/>
406+
</container>
407+
408+
.. code-block:: php
409+
410+
// config/packages/framework.php
411+
$container->setParameter('env(AUTH_FILE)', '../config/auth.json');
412+
$container->loadFromExtension('google', [
413+
'auth' => '%env(trim:file:AUTH_FILE)%',
414+
]);
415+
379416
.. versionadded:: 4.3
380417

381418
The ``trim`` processor was introduced in Symfony 4.3.

0 commit comments

Comments
 (0)