Skip to content

debug:dotenv does not work with custom dotenv_path. #58987

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
Bilge opened this issue Nov 25, 2024 · 3 comments
Closed

debug:dotenv does not work with custom dotenv_path. #58987

Bilge opened this issue Nov 25, 2024 · 3 comments

Comments

@Bilge
Copy link
Contributor

Bilge commented Nov 25, 2024

Symfony version(s) affected

6.4.15

Description

debug:dotenv does not work with custom dotenv_path. Note that Symfony itself scans and interprets all the files correctly, only this console command fails; it does not pick up any files or variables at all.

How to reproduce

  1. Set extra.runtime.dotenv_path to a custom path in composer.json.
  2. Move all dotenv files into the custom path.

Possible Solution

No response

Additional Context

❯ bin/console debug:dotenv

Dotenv Variables & Files
========================

Scanned Files (in descending priority)
--------------------------------------

 * ⨯ .env.local.php
 * ⨯ .env.dev.local
 * ⨯ .env.dev
 * ⨯ .env.local
 * ⨯ .env

Variables
---------

 ---------- -------
  Variable   Value
 ---------- -------

 // Note that values might be different between web and CLI.
@Ejamine
Copy link

Ejamine commented Nov 27, 2024

This command expects the environment variable SYMFONY_DOTENV_PATH to be set or it falls back to the project directory. So, if your files are located in a directory called dotenv, you can use this command SYMFONY_DOTENV_PATH=dotenv/.env bin/console debug:dotenv.
I hope this can help.

@GromNaN
Copy link
Member

GromNaN commented Nov 27, 2024

This is a new feature that have been merged in 7.1: #52638

@xabbuh
Copy link
Member

xabbuh commented Nov 27, 2024

@Bilge Can you check if #59007 fixes this?

nicolas-grekas added a commit that referenced this issue Nov 27, 2024
…otenv command (xabbuh)

This PR was merged into the 5.4 branch.

Discussion
----------

[Dotenv] read runtime config from composer.json in debug dotenv command

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #58987
| License       | MIT

same approach as what we already did for the dump command in #45430

Commits
-------

9f4345f read runtime config from composer.json in debug dotenv command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants