Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Routing][FrameworkBundle] Allow using env() in route conditions#35747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
/cc@nicolas-grekas@HeahDude Here is an experimentation/second implementation of#35727 |
e1f164c
to84a22c6
Compareb14fb2e
to2d30cf3
Comparesrc/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Routing/Matcher/ExpressionLanguageProvider.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
732ef18
toa40e319
Compare6177069
to9431dc6
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Great, I like it a lot :)
Some minor details and good to go on my side.
src/Symfony/Component/Routing/Tests/Matcher/ExpressionLanguageTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Routing/Tests/Matcher/ExpressionLanguageTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
9431dc6
to78ad4b9
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looks good, thanks@atailouloute@nicolas-grekas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nice!
src/Symfony/Component/Routing/Tests/Matcher/ExpressionLanguageTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Routing/Tests/Matcher/ExpressionLanguageTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
19682cb
to5f495d7
Compareff17ac7
to357fc77
Compare357fc77
to8259713
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
FYI, I improved the feature by adding a newrouting.expression_language_function
tag to make adding new functions easy. This leveragesServiceProviderInterface
and tagged locators.
8259713
to1beb7b0
Compare1beb7b0
tob574460
CompareThank you@atailouloute. |
Thanks for this feature@atailouloute. I used it today to match host using env var; only way to make it dynamic with prebuild Symfony cache. |
…mNaN)This PR was merged into the 5.4 branch.Discussion----------[Routing] doc for env() function in route conditionFix#13247 forsymfony/symfony#35747Very useful to match host based on env var.```yamlblog_list: path: /blog # the controller value has the format 'controller_class::method_name' controller: App\Controller\BlogController::list condition: "context.getHost() == env('APP_MAIN_HOST')"```Commits-------c22dc20 Documentation for env() function in route condition
Uh oh!
There was an error while loading.Please reload this page.
This is a second implementation of#35727, it overcomes the limitation mentioned by nicolas in (#35727 (comment))
The goal of this feature is to be able to use env variables in Route conditions (it supports also env processors/ loaders)
TODOs: