Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update %env()% documentation #8382

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

Closed
ro0NL opened this issue Sep 10, 2017 · 3 comments · Fixed by #9507
Closed

Update %env()% documentation #8382

ro0NL opened this issue Sep 10, 2017 · 3 comments · Fixed by #9507
Labels
actionable Clear and specific issues ready for anyone to take them. DependencyInjection
Milestone

Comments

@ro0NL
Copy link
Contributor

ro0NL commented Sep 10, 2017

See symfony/symfony#23901 + symfony/symfony#23888

Just a ticket for reference now :)

@xabbuh xabbuh added the actionable Clear and specific issues ready for anyone to take them. label Sep 22, 2017
@xabbuh xabbuh added this to the 3.4 milestone Sep 22, 2017
@javiereguiluz
Copy link
Member

@ro0NL
Copy link
Contributor Author

ro0NL commented Mar 3, 2018

It's getting ready :) i think for most users things will work out-of-the-box / as expected.

Nevertheless if you decide to document more advanced stuff when using env vars, i think these points are worth mentioning related to the Config tier;

  • no real env lookup, config is validated with dummy env values based on the prefix (string by default)
    • this happens at normalization, merging and finalizing level (main Processor API)
  • env placeholder can be detected with normalization closures upfront, and thus can be normalized
    • if the user normalizes a different value; then either the type changed or the string value changed (the placeholder is concatenated or so). In that case processing continues as usual (it doesnt use dummy value as it's a regular string)
  • env vars are not compatible with enum nodes because we expect a known value (envs can be anything)
  • env vars are not compatible with array nodes (either being prototyped yes/no) because that's part of the semantic structure, thus needs processing (normalizing, merging, validating)

symfony-splitter pushed a commit to symfony/dependency-injection that referenced this issue Mar 27, 2018
This PR was squashed before being merged into the 4.1-dev branch (closes #23888).

Discussion
----------

[DI] Validate env vars in config

| Q             | A
| ------------- | ---
| Branch?       | 4.1/master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22151, #25868
| License       | MIT
| Doc PR        | symfony/symfony-docs#8382

This PR registers the env placeholders in `Config\BaseNode` with its default value or an empty string. It doesnt request real env vars during compilation,

What it does is if a config value exactly matches a env placeholder, we validate/normalize the default value/empty string but we keep returning the env placeholder as usual. If a placeholder occurs in the middle of a string it also proceeds as usual.

The latter to me is OK as you need to expect any string value during runtime anyway,  including the empty string.

Commits
-------

2c74fbc [DI] Validate env vars in config
nicolas-grekas added a commit to symfony/symfony that referenced this issue Mar 27, 2018
This PR was squashed before being merged into the 4.1-dev branch (closes #23888).

Discussion
----------

[DI] Validate env vars in config

| Q             | A
| ------------- | ---
| Branch?       | 4.1/master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22151, #25868
| License       | MIT
| Doc PR        | symfony/symfony-docs#8382

This PR registers the env placeholders in `Config\BaseNode` with its default value or an empty string. It doesnt request real env vars during compilation,

What it does is if a config value exactly matches a env placeholder, we validate/normalize the default value/empty string but we keep returning the env placeholder as usual. If a placeholder occurs in the middle of a string it also proceeds as usual.

The latter to me is OK as you need to expect any string value during runtime anyway,  including the empty string.

Commits
-------

2c74fbc [DI] Validate env vars in config
javiereguiluz added a commit that referenced this issue May 27, 2018
…guiluz)

This PR was merged into the master branch.

Discussion
----------

Document the built in env var processors

This is start at adding documentation for env var processors, e.g. `%env(int:FOO)%`

I would welcome some feedback, if this a appropriate way to go about this, I think it needs some more examples to show how its used.

It also would ideally add a description of how custom processors are added, although that might be a later request.

starts to fix #8382, #9094

Commits
-------

aed1607 Minor rewords and formatting fixes
e3fe5fe Example of customer env var processor
67227a6 Add examples for parameter processors
cd353c7 Add description of the built in envvar processors
@javiereguiluz
Copy link
Member

Fixed by #9507.

javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this issue May 27, 2018
…javiereguiluz)

This PR was merged into the 3.4 branch.

Discussion
----------

Document the built in env var processors

This is start at adding documentation for env var processors, e.g. `%env(int:FOO)%`

I would welcome some feedback, if this a appropriate way to go about this, I think it needs some more examples to show how its used.

It also would ideally add a description of how custom processors are added, although that might be a later request.

starts to fix symfony#8382, symfony#9094

Commits
-------

aed1607 Minor rewords and formatting fixes
e3fe5fe Example of customer env var processor
67227a6 Add examples for parameter processors
cd353c7 Add description of the built in envvar processors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable Clear and specific issues ready for anyone to take them. DependencyInjection
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants