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

[Dotenv] Reimplementing symfony/flex' dump-env as a Symfony command#42610

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
nicolas-grekas merged 2 commits intosymfony:5.4fromabdielcs:5.4
Sep 30, 2021

Conversation

@abdielcs
Copy link
Contributor

@abdielcsabdielcs commentedAug 17, 2021
edited by nicolas-grekas
Loading

QA
Branch?5.4
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#40381
LicenseMIT
Doc PR-

[FrameworkBundle] Reimplementing the symfony/flex env-dump as a symfony command. Most of code copied fromhttps://github.com/symfony/flex/blob/main/src/Command/DumpEnvCommand.php

The command is not registered by default. In order to enable it, one must add it to theirservices.yaml file:

services:Symfony\Component\Dotenv\Command\DotenvDumpCommand:        -'%kernel.project_dir%/.env'        -'%kernel.environment%'

On PHP >= 8, the two arguments can be removed when autoconfiguration is enabled (which is the default):

services:Symfony\Component\Dotenv\Command\DotenvDumpCommand:~

apfelbox, mbrodala, jdreesen, BafS, and chr-hertel reacted with thumbs up emojimbrodala, gndk, and fbourigault reacted with heart emoji
Copy link
Contributor

@t-richardt-richard 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.

Its also missing tests. Seehttps://github.com/symfony/flex/blob/main/tests/Command/DumpEnvCommandTest.php

Otherwise I'm 👍, it also proved to be sub-optimal for me to have it as a composer plugin command rather than a symfony command.

It would be great if you were also able to submit a PR tohttps://github.com/symfony/flex for the deprecation of the the command.

@nicolas-grekasnicolas-grekas added this to the5.4 milestoneAug 18, 2021
@abdielcs
Copy link
ContributorAuthor

Help with this issues please?unset($_ENV['SYMFONY_DOTENV_VARS']) came from original code inhttps://github.com/symfony/flex/blob/main/src/Command/DumpEnvCommand.php and need to be done to pass tests, and Psalm insists that is not set. Not sure what need to be done to rebase upstream. Seems also a test is failing from HttpKernel.

@ro0NL
Copy link
Contributor

Seevimeo/psalm#6337

@nicolas-grekasnicolas-grekas changed the title[FrameworkBundle] feature #40381 Reimplementing the symfony/flex env-dump as a symfony command.[FrameworkBundle] Reimplementing the symfony/flex env-dump as a symfony command.Sep 8, 2021
@nicolas-grekas
Copy link
Member

Please rebase and squash also (PR should not contain any merge commits)

@derrabusderrabus changed the title[FrameworkBundle] Reimplementing the symfony/flex env-dump as a symfony command.[FrameworkBundle] Reimplementing the symfony/flex env-dump as a symfony commandSep 8, 2021
@carsonbotcarsonbot changed the title[FrameworkBundle] Reimplementing the symfony/flex env-dump as a symfony command[Dotenv][FrameworkBundle] Reimplementing the symfony/flex env-dump as a symfony commandSep 8, 2021
@nicolas-grekas
Copy link
Member

We might need to implementsymfony/flex#810 in this also.
@abdielcs are you still available to finish this PR?

abdielcs reacted with eyes emoji

@abdielcs
Copy link
ContributorAuthor

We might need to implementsymfony/flex#810 in this also.
@abdielcs are you still available to finish this PR?

@nicolas-grekas Al the work is done, but I can't managed to pass the rebase. Really would appreciate help here. Sorry for been so newbie doing PR.

@nicolas-grekasnicolas-grekas changed the title[Dotenv][FrameworkBundle] Reimplementing the symfony/flex env-dump as a symfony command[Dotenv][FrameworkBundle] Reimplementing symfony/flex' dump-env as a Symfony commandSep 27, 2021
@nicolas-grekas
Copy link
Member

@abdielcs I rebased the PR and pushed it on your fork. Please fetch and sync your local copy before moving the command to the component.

@carsonbotcarsonbot changed the title[Dotenv][FrameworkBundle] Reimplementing symfony/flex' dump-env as a Symfony command[Dotenv] Reimplementing symfony/flex' dump-env as a Symfony commandSep 30, 2021
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

I rebased the PR and added a second commit to completly decouple the command from FrameworkBundle.

@abdielcs I saw that you somehow messed up with the git history in previous iterations. As a general rule of thumb, do never ever usegit merge when working on PRs for open-source projects. Usegit rebase instead.

mbrodala reacted with thumbs up emojiabdielcs reacted with eyes emoji
@nicolas-grekas
Copy link
Member

Thank you@abdielcs.

@mbrodala
Copy link
Contributor

Awesome thanks a lot!

This was referencedNov 5, 2021
leofeyer pushed a commit to contao/contao that referenced this pull requestFeb 29, 2024
…dition (see#6954)Description-----------We know that Contao is mostly deployed on hosting providers that do not support real environment variables but we also rely on the `Dotenv` component ourselves for e.g. Mailer configuration etc.For performance reasons, on those systems I would like to run `dotenv:dump` so Symfony dumps `.env.local.php` which is way faster as it can be cached in OPCode cache. Of course, you cannot change `.env.local` anymore without also updating that file then. But you will have to add `dotenv:dump` to your deploy chain manually anyway so you'll know that - it doesn't happen just like that.However, the command is not registered by default in Symfony even though it has been around since Symfony 5.4. Seesymfony/symfony#42610. This means that right now I have to add this configuration to every ME but given the fact of our hosting provider situation, I think this qualifies to be a good default.Again, it just makes sure the command is around, you'll still have to use it yourself.Commits-------5f18133 Register the dotenv:dump command by default in the Contao ME11337ab Adjust service namef236946 Update manager-bundle/config/services.yaml
leofeyer pushed a commit to contao/manager-bundle that referenced this pull requestFeb 29, 2024
…dition (see #6954)Description-----------We know that Contao is mostly deployed on hosting providers that do not support real environment variables but we also rely on the `Dotenv` component ourselves for e.g. Mailer configuration etc.For performance reasons, on those systems I would like to run `dotenv:dump` so Symfony dumps `.env.local.php` which is way faster as it can be cached in OPCode cache. Of course, you cannot change `.env.local` anymore without also updating that file then. But you will have to add `dotenv:dump` to your deploy chain manually anyway so you'll know that - it doesn't happen just like that.However, the command is not registered by default in Symfony even though it has been around since Symfony 5.4. Seesymfony/symfony#42610. This means that right now I have to add this configuration to every ME but given the fact of our hosting provider situation, I think this qualifies to be a good default.Again, it just makes sure the command is around, you'll still have to use it yourself.Commits-------5f181332 Register the dotenv:dump command by default in the Contao ME11337abd Adjust service namef236946e Update manager-bundle/config/services.yaml
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@derrabusderrabusderrabus approved these changes

@OskarStarkOskarStarkAwaiting requested review from OskarStark

+2 more reviewers

@ro0NLro0NLro0NL left review comments

@t-richardt-richardt-richard requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

Provide "dump-env" as regular Symfony command

8 participants

@abdielcs@ro0NL@nicolas-grekas@mbrodala@OskarStark@derrabus@t-richard@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp