-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Improve %env()% parameters in debug:config output #20684
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
Comments
See #20688 for the unresolved part. |
I don't know if the Yaml dumper supports dumping comments as in the suggested excerpt. |
@nicolas-grekas |
@nicolas-grekas In fact, we are both right: they are only half resolved |
So, in #20704, I fix the buggy part, yet env vars are not replaced by their actual values for now. |
I'm closing this as "fixed" because I've tested this with 3.3 and 3.4 and it works as expected. Replacing the env vars by their actual values should be considered as a different feature. Thanks! |
This is actually still broken in Symfony 4.1.1 as it crashes validation. For example if using this in a bundle configuration: ->scalarNode('my_api_url')
->isRequired()
->validate()
->ifTrue(function ($val) { return !preg_match('#^https?://[^\s]+$#', $val); })
->thenInvalid('"%s" must be a valid URL with http/https scheme')
->end()
->end() And then configuring this as:
The
|
@curry684 in this case that's expected: how dear would it be possible to validate at compile time a value that is known at runtime? Env vars are not compatible with every situations. At some point, this has to be supported case by case, option by option, by refactoring the code to use runtime factories that embed some validation. But only when it makes sense. Turning all options to dynamic factories would basically mean turning off compilation. Not wanted either. |
@nicolas-grekas I'm not saying it can be fixed by showing an unknown mutable value, I'm just saying it's not DX-friendly that it crashes completely. We could surely fix Also, in my specific case it wouldn't have had to crash as There's certainly room for improvement there over a blunt validation exception, as it more or less obsoletes But no, if it were an easy fix I would've made the PR already, or opened a separate issue, over remarking here that the discussed behavior is still broken in a lot of cases. |
As `debug:config` only resolved back to original placeholders these could then fail validation if present. Refs symfony#20684 (comment)
Problem
When using runtime env variables for config:
The output of
debug:config
looks like this:Although the output is technically precise, it looks weird and even like an error.
Solution
Could we keep the original value of those parameters? (Maybe displaying their default values too)
The text was updated successfully, but these errors were encountered: