Commit 985738d
committed
[Dotenv] Use
When overriding the `dotenv_path` directly in the `index.php` or `console` file like this:
```php
// public/index.php
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
$_SERVER['APP_RUNTIME_OPTIONS'] = [
'dotenv_path' => '.env.path'
];
return function (array $context): Kernel {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
```
The `dotenv:dump` command was ignoring this value and used the default `.env` path, which resulted in two things:
* The file was still generated (with wrong values), but ...
* It was never used since the application itself used the `dotenv_path` from the runtime options and could not find the corresponding `*.local.php` file in the updated path
To fix this, the command itself now checks if the `SYMFONY_DOTENV_PATH` env variable is set. If it is, its value is used instead of checking composer for falling back to the `.env` file.SYMFONY_DOTENV_PATH variable when dumping local dotenv1 parent 1c7c255 commit 985738d
2 files changed
Lines changed: 40 additions & 4 deletions
File tree
- src/Symfony/Component/Dotenv
- Command
- Tests/Command
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| |||
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
93 | | - | |
| 96 | + | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
| |||
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
| 42 | + | |
40 | 43 | | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| |||
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
95 | 128 | | |
96 | 129 | | |
97 | 130 | | |
| |||
0 commit comments