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] Detect unused environment variables in .env#49161

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

Open
mw3e21a wants to merge7 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
frommw3e21a:detect-unused-env-vars

Conversation

mw3e21a
Copy link
Contributor

@mw3e21amw3e21a commentedJan 30, 2023
edited by GromNaN
Loading

QA
Branch?6.3
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#48552
LicenseMIT
Doc PRsymfony/symfony-docs#17833

Improvedbin/console debug:container --env-vars and the--env-var option to display the number of occurrences of each environment variable in the container. This allows you to identify unused variables from .env files.

Example usage:
php bin/console debug:container --env-vars

image

php bin/console debug:container --env-var=APP_SECRET

image

valtzu reacted with thumbs up emojiAlexandreGerault reacted with heart emoji94noni reacted with eyes emoji
@carsonbotcarsonbot added this to the6.3 milestoneJan 30, 2023
@mw3e21amw3e21a changed the titleDetect unused environment variables in .env[FrameworkBundle] Detect unused environment variables in .envJan 30, 2023
Copy link
Member

@GromNaNGromNaN left a comment
edited
Loading

Choose a reason for hiding this comment

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

I like this way of demonstrating usage of each variable.

Here is the output forsymfony/demo. We can see thatAPP_ENV is not used by the container (because it is used earlier).

$bin/console debug:container --env-varsSymfony Container Environment Variables======================================= ------------------- ------------------ ------------------------------------------------------- -------------  Name                Default value      Real value                                              Usage count ------------------- ------------------ ------------------------------------------------------- -------------  APP_ENV             n/a                "dev"                                                   0  APP_SECRET          n/a                "2ca64f8d83b9e89f5f19d672841d6bb8"                      8  DATABASE_URL        n/a                "sqlite:///%kernel.project_dir%/data/database.sqlite"   1  VAR_DUMPER_SERVER   "127.0.0.1:9912"   n/a                                                     3 ------------------- ------------------ ------------------------------------------------------- ------------- // Note real values might be different between web and CLI.

@mw3e21a
Copy link
ContributorAuthor

@GromNaN Thanks for the suggestions, I made changes in the code.

GromNaN reacted with thumbs up emoji

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.

Yet an other review, sorry it's so fragmented on my part.

@nicolas-grekasnicolas-grekas modified the milestones:6.3,6.4May 23, 2023
@nicolas-grekasnicolas-grekas modified the milestones:6.4,7.1Nov 15, 2023
@xabbuhxabbuh modified the milestones:7.1,7.2May 15, 2024
@fabpotfabpot modified the milestones:7.2,7.3Nov 20, 2024
@fabpotfabpot removed this from the7.3 milestoneMay 26, 2025
@fabpotfabpot added this to the7.4 milestoneMay 26, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@GromNaNGromNaNAwaiting requested review from GromNaN

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

Detect unused environment variables in .env
6 participants
@mw3e21a@GromNaN@fabpot@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp