Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[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

Merged
merged 1 commit into from
Mar 9, 2022
Merged

[Config] Allow using environment variables in EnumNode #45624

merged 1 commit into from
Mar 9, 2022

Conversation

ecourtial
Copy link

Q A
Branch? 6.1
Bug fix? no
New feature? yes
Deprecations? no
Tickets
License MIT
Doc PR

In the EnumNode of the Config component, we see that it does not allow the use of a placeholder:

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.

@carsonbot
Copy link

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:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.1 branch.

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!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@ro0NL
Copy link
Contributor

ro0NL commented Mar 3, 2022

maybe reasonable 👍

(the reason behind current behavior is we cant assume env values always fit the enum)

@ecourtial
Copy link
Author

What are the differences between the high-deps and the low_deps jobs? The first one is failing like if one of the changes is not considered. I guess it is related to the fact it is in two separate modules?

@ecourtial ecourtial changed the title [WIP] Config: add the possibility to use placeholders in EnumNodes Config: add the possibility to use placeholders in EnumNodes Mar 4, 2022
src/Symfony/Component/Config/CHANGELOG.md Outdated Show resolved Hide resolved
@nicolas-grekas nicolas-grekas changed the title Config: add the possibility to use placeholders in EnumNodes Allow using environment variables in EnumNode Mar 4, 2022
@carsonbot carsonbot changed the title Allow using environment variables in EnumNode [Config] Allow using environment variables in EnumNode Mar 4, 2022
nicolas-grekas added a commit that referenced this pull request Mar 8, 2022
… 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
@fabpot
Copy link
Member

fabpot commented Mar 9, 2022

Thank you @ecourtial.

@vince83110
Copy link

maybe reasonable 👍

(the reason behind current behavior is we cant assume env values always fit the enum)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.