Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ac932f2

Browse filesBrowse files
committed
Merge branch '4.4'
* 4.4: Add example for env var processor: trim
2 parents 68dcc69 + f39b2af commit ac932f2
Copy full SHA for ac932f2

File tree

1 file changed

+37
-0
lines changed
Filter options

1 file changed

+37
-0
lines changed

‎configuration/env_var_processors.rst

Copy file name to clipboardExpand all lines: configuration/env_var_processors.rst
+37Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,43 @@ Symfony provides the following env var processors:
372372
and end of the string. This is especially useful in combination with the
373373
``file`` processor, as it'll remove newlines at the end of a file.
374374

375+
.. configuration-block::
376+
377+
.. code-block:: yaml
378+
379+
# config/packages/framework.yaml
380+
parameters:
381+
env(AUTH_FILE): '../config/auth.json'
382+
google:
383+
auth: '%env(trim:file:AUTH_FILE)%'
384+
385+
.. code-block:: xml
386+
387+
<!-- config/packages/framework.xml -->
388+
<?xml version="1.0" encoding="UTF-8" ?>
389+
<container xmlns="http://symfony.com/schema/dic/services"
390+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
391+
xmlns:framework="http://symfony.com/schema/dic/symfony"
392+
xsi:schemaLocation="http://symfony.com/schema/dic/services
393+
https://symfony.com/schema/dic/services/services-1.0.xsd
394+
http://symfony.com/schema/dic/symfony
395+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
396+
397+
<parameters>
398+
<parameter key="env(AUTH_FILE)">../config/auth.json</parameter>
399+
</parameters>
400+
401+
<google auth="%env(trim:file:AUTH_FILE)%"/>
402+
</container>
403+
404+
.. code-block:: php
405+
406+
// config/packages/framework.php
407+
$container->setParameter('env(AUTH_FILE)', '../config/auth.json');
408+
$container->loadFromExtension('google', [
409+
'auth' => '%env(trim:file:AUTH_FILE)%',
410+
]);
411+
375412
``env(key:FOO:BAR)``
376413
Retrieves the value associated with the key ``FOO`` from the array whose
377414
contents are stored in the ``BAR`` env var:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.