Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[WIP][DependencyInjection] Issue #7555 - Resolve environment variables at runtime#10138

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

Closed
lavoiesl wants to merge1 commit intosymfony:masterfromlavoiesl:issue-7555-env-vars
Closed

Conversation

@lavoiesl
Copy link
Contributor

QA
Bug fix?no
New feature?yes
BC breaks?minimal
Deprecations?no
Tests pass?yes
Fixed tickets#7555
LicenseMIT
Doc PRTODO
  • basic tests
  • performance tests
  • Deep tests
  • documentation

This allows to set a parameterenvironment_map that contains a map[$parameter => $env_var]. This allows to callParameterBag::resolveEnvironmentMap even after the bag was initially resolved and frozen. As mentioned by@stof, dependent parameter can not be resolved anymore, so it is forbidden to reference a parameter in the environment map elsewhere. However,resolveEnvironmentMap will useresolveValue, so it is possible to reference another parameter in the enviromnent variable.

HttpKernel now callsParameterBag::resolveEnvironmentMap after theContainer was fully loaded.

I am not entirely sure of the implication of this method with the caching mechanism, the cache warmers, etc. I could use some help from someone with a better understanding of the whole thing.

The only BC break is thatenvironment_map is not a valid parameter name anymore, it is reserved.

@lavoiesl
Copy link
ContributorAuthor

So far, the issues in the build do not seem to be linked to this PR.

@mvrhov
Copy link

Can I suggest an improvement.. This run-time resolver could also resolve the parameters set via the newly introduced expression engine.

@lavoiesl
Copy link
ContributorAuthor

This could indeed be considered, but this would be a separate PR isn’t it ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Property names should use camel case

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks

@fabpot
Copy link
Member

Closing as it does not fix the problem in all cases (see the referenced other PR I created which also failed).

@fabpotfabpot closed thisNov 12, 2015
fabpot added a commit that referenced this pull requestSep 15, 2016
…env(MY_ENV_VAR)% (nicolas-grekas)This PR was merged into the 3.2-dev branch.Discussion----------[DI] Allow injecting ENV parameters at runtime using %env(MY_ENV_VAR)%| Q             | A| ------------- | ---| Branch?       | master| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#10138,#7555,#16403,#18155| License       | MIT| Doc PR        |symfony/symfony-docs#6918This is an alternative approach to#18155 for injecting env vars into container configurations.With this PR, anywhere parameters are allowed, one can use `%env(ENV_VAR)%` to inject a dynamic env var. Additionally, if one sets a value to such parameters in e.g. the `parameter.yml` file (`env(ENV_VAR): foo`), this value will be used as a default value when the env var is not defined. If no default value is specified, an `EnvVarNotFoundException` will be thrown at runtime.Unlike previous attempts that also used parameters (#16403), the implementation is compatible with DI extensions: before being dumped, env vars are resolved to uniquely identifiable string placeholders that can get through DI extensions manipulations. When dumped, these unique placeholders are replaced by dynamic calls to a getEnv method..ping@magnusnordlander@dzuelke@fabpotCommits-------bac2132 [DI] Allow injecting ENV parameters at runtime using %env(MY_ENV_VAR)% syntax
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@lavoiesl@mvrhov@fabpot@stof

[8]ページ先頭

©2009-2025 Movatter.jp