-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Config] Allow using environment variables in EnumNode
#45624
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
[Config] Allow using environment variables in EnumNode
#45624
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
maybe reasonable 👍 (the reason behind current behavior is we cant assume env values always fit the enum) |
What are the differences between the |
src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php
Show resolved
Hide resolved
EnumNode
EnumNode
EnumNode
… in EmumNode in 6.1 (ecourtial) This PR was merged into the 4.4 branch. Discussion ---------- Remove blocking test for adding support for placeholders in EmumNode in 6.1 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Remove blocking test for the PR #45624 Commits ------- a0bce33 Remove blocking test for adding support for placeholders in EmumNode in 6.1
Thank you @ecourtial. |
For my curiosity, why you didn't rely on the enum error itself ? If the env value doesn't fit the enum, you throw a correct error explaining that the value doesn't fit the enum. It is a weird behavior, thanks for the PR. |
In the EnumNode of the Config component, we see that it does not allow the use of a placeholder:
symfony/src/Symfony/Component/Config/Definition/EnumNode.php
Line 63 in 5fbd0dc
This is strange, because we could have some use cases where we would like to be able to define the value with a env variable. A good example is the samesite policy for the session cookie : https://symfony.com/blog/new-in-symfony-4-2-samesite-cookie-configuration.
Note: I have not submitted any documentation update so far, I am not even sure it is a "new" feature.