8000 [Dotenv] [DumpCommand] Incorrectly detected envKey if it differs from APP_ENV · Issue #53864 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Dotenv] [DumpCommand] Incorrectly detected envKey if it differs from APP_ENV #53864
Closed
@scruwi

Description

@scruwi

Symfony version(s) affected

6.4

Description

If env_var_name in composer.json differs from the standard APP_ENV, then .env.PRODUCTION file will be ignored by the command bin/console dotenv:dump PRODUCTION

How to reproduce

composer.json:

"extra": {
    "runtime": {
        "env_var_name": "ENV"
    }
}

Create files:

  • .env
  • .env.local
  • .env.local.PRODUCTION

Run bin/console dotenv:dump PRODUCTION

Possible Solution

Method DotenvDumpCommand::loadEnv(), instantiate DotEnv with correct envKey:

$envKey = $config['env_var_name'] ?? 'APP_ENV';
$dotenv = new Dotenv($envKey);

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0