@@ -370,6 +370,8 @@ arbitrary matching logic:
370370 condition : " context.getMethod() in ['GET', 'HEAD'] and request.headers.get('User-Agent') matches '/firefox/i'"
371371 # expressions can also include configuration parameters:
372372 # condition: "request.headers.get('User-Agent') matches '%app.allowed_browsers%'"
373+ # expressions can even use environment variables:
374+ # condition: "context.getHost() == env('APP_MAIN_HOST')"
373375
374376 .. code-block :: xml
375377
@@ -384,6 +386,8 @@ arbitrary matching logic:
384386 <condition >context.getMethod() in ['GET', 'HEAD'] and request.headers.get('User-Agent') matches '/firefox/i'</condition >
385387 <!-- expressions can also include configuration parameters: -->
386388 <!-- <condition>request.headers.get('User-Agent') matches '%app.allowed_browsers%'</condition> -->
389+ <!-- expressions can even use environment variables: -->
390+ <!-- <condition>context.getHost() == env('APP_MAIN_HOST')</condition> -->
387391 </route >
388392 </routes >
389393
@@ -398,7 +402,9 @@ arbitrary matching logic:
398402 ->controller([DefaultController::class, 'contact'])
399403 ->condition('context.getMethod() in ["GET", "HEAD"] and request.headers.get("User-Agent") matches "/firefox/i"')
400404 // expressions can also include configuration parameters:
401- // 'request.headers.get("User-Agent") matches "%app.allowed_browsers%"'
405+ // ->condition('request.headers.get("User-Agent") matches "%app.allowed_browsers%"')
406+ // expressions can even use environment variables:
407+ // ->condition('context.getHost() == env("APP_MAIN_HOST")')
402408 ;
403409 };
404410
@@ -414,10 +420,10 @@ and can use any of these variables created by Symfony:
414420 The :ref: `Symfony Request <component-http-foundation-request >` object that
415421 represents the current request.
416422
417- Additionnal functions are provided :
423+ You can also use this function :
418424
419425``env(string $name) ``
420- Read a variable using :doc: `Environment Variable Processors <configuration/env_var_processors >`
426+ Returns the value of a variable using :doc: `Environment Variable Processors <configuration/env_var_processors >`
421427
422428Behind the scenes, expressions are compiled down to raw PHP. Because of this,
423429using the ``condition `` key causes no extra overhead beyond the time it takes
0 commit comments