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

[FrameworkBundle] Addresolve-env option to debug:config command#46821

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

Merged
fabpot merged 1 commit intosymfony:6.2fromalexandre-daubois:feat-resolve-env
Jul 21, 2022

Conversation

@alexandre-daubois
Copy link
Member

@alexandre-dauboisalexandre-daubois commentedJul 1, 2022
edited
Loading

QA
Branch?6.2
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#40582
LicenseMIT
Doc PRNA

Add--resolve-env option todebug:config command to display actual values of environment variables in dumped configuration.

This main purpose of this command is debugging as its name suggests. In order to help the developer to debug its configuration, it is convenient to display the actual value of environment variables present in the dumped configuration, instead of placeholders.

Here is the result:

$ symfony console debug:config framework | grep secret    secret: '%env(APP_SECRET)%'    secrets:        vault_directory: '/home/alexandredaubois/(...)/config/secrets/%env(default:kernel.environment:APP_RUNTIME_ENV)%'$ symfony console debug:config framework --resolve-env | grep secret    secret: 90d83502629d64dec4cd6e33c9b31267    secrets:        vault_directory: /home/alexandredaubois/(...)/config/secrets/dev

ro0NL, ogizanagi, melkamar, ismail1432, GromNaN, Kocal, and Jibbarth reacted with thumbs up emoji
@carsonbot
Copy link

Hey!

I think@jack-worman has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

Copy link
Member

@GromNaNGromNaN left a comment

Choose a reason for hiding this comment

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

Very nice feature. It simplifies debug of env var processing.

Thanks to it, I found something that looks like a bug.

$SYMFONY_DECRYPTION_SECRET=Zm9v bin/console debug:config framework secrets.decryption_env_var --resolve-envCurrent configuration for "framework.secrets.decryption_env_var"================================================================'base64:default::SYMFONY_DECRYPTION_SECRET'

alexandre-daubois reacted with thumbs up emoji
@alexandre-daubois
Copy link
MemberAuthor

Didn't think of this case@GromNaN, thank you! I'm taking a look at it soon.

@GromNaN
Copy link
Member

GromNaN commentedJul 13, 2022
edited
Loading

That seems to be a special feature made by@nicolas-grekas. The value is correctly resolved by the command from a config pov.

if ($config['decryption_env_var']) {
if (!preg_match('/^(?:[-.\w\\\\]*+:)*+\w++$/',$config['decryption_env_var'])) {
thrownewInvalidArgumentException(sprintf('Invalid value "%s" set as "decryption_env_var": only "word" characters are allowed.',$config['decryption_env_var']));
}
if (ContainerBuilder::willBeAvailable('symfony/string', LazyString::class, ['symfony/framework-bundle'])) {
$container->getDefinition('secrets.decryption_key')->replaceArgument(1,$config['decryption_env_var']);
}else {
$container->getDefinition('secrets.vault')->replaceArgument(1,"%env({$config['decryption_env_var']})%");
$container->removeDefinition('secrets.decryption_key');
}

@GromNaN
Copy link
Member

There is a conflict in the changelog, can you rebase please?

@alexandre-daubois
Copy link
MemberAuthor

Very interesting, thank you for the investigation Jérôme!

Also, the rebase is done 🙂

@fabpot
Copy link
Member

Thank you@alexandre-daubois.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@GromNaNGromNaNGromNaN approved these changes

+1 more reviewer

@alamiraultalamiraultalamirault approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

6.2

Development

Successfully merging this pull request may close these issues.

Add a way to resolve environment variables in debug:config

5 participants

@alexandre-daubois@carsonbot@GromNaN@fabpot@alamirault

[8]ページ先頭

©2009-2025 Movatter.jp