-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Negated (not:) env var processor #40169
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bbf79ba
to
bf08da7
Compare
Travis seems unhappy, doesn't look related. |
bf08da7
to
0205893
Compare
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.
Yes, thanks 😊
( but see CI ) |
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.
CI failures are unrelated. The component's changelog needs to be updated though
Changelog updated, doc PR submitted here. |
b42c825
to
56545fd
Compare
Thank you @bpolaszek. |
… (bpolaszek) This PR was squashed before being merged into the 5.3-dev branch. Discussion ---------- [DependencyInjection] Negated (not:) env var processor This PR adds documentation for symfony/symfony#40169: negated env var processor: ------ Casts to a bool (just as `env(bool:...)` does) except it returns the inverted value(falsy values are returned as `true`, truthy values are returned as `false`): ```yaml # config/services.yaml parameters: safe_for_production: '%env(not:APP_DEBUG)%' ``` Commits ------- 3ff812d [DependencyInjection] Negated (not:) env var processor
This little PR suggests a
not:
env var processor (in a perfect world, I would name it!:
but only words are accepted as prefixes 🙃)Goal is to negate a boolean env variable.
Example usage:
I'm thinking of this for this kind of usages:
some_prod_related_stuff: '%env(not:APP_DEBUG)%'
enabled: '%env(not:bool:key:disabled:query_string:SOME_DSN)%'
Processor raises an exception when preceding resolved value is not a boolean.This processor allows any truthy/falsy values, like
bool:
.Thank you,
Ben