Skip to content

Commit 1b87fe9

Browse files
committed
add dotenv
1 parent 73282fe commit 1b87fe9

File tree

5 files changed

+233
-5
lines changed

5 files changed

+233
-5
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,6 @@ cypress/videos/
126126

127127
# rector
128128
.rector.result.cache
129+
130+
#dotenv
131+
.env

app/Mage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
include_once $path;
5555
}
5656

57+
$dotenv = Dotenv\Dotenv::createImmutable(BP);
58+
$dotenv->safeLoad();
59+
$dotenv->ifPresent(['MAGE_IS_DEVELOPER_MODE', 'OPENMAGE_CONFIG_OVERRIDE_ALLOWED'])->isInteger();
60+
5761
/**
5862
* Main Mage hub class
5963
*/

app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,7 @@ public function setEnvStore(array $envStorage): void
306306
public function getEnv(): array
307307
{
308308
if (empty($this->envStore)) {
309-
$env = getenv();
310-
$env = array_filter($env, function ($key) {
309+
$env = array_filter($_ENV, function ($key) {
311310
return str_starts_with($key, self::ENV_STARTS_WITH);
312311
}, ARRAY_FILTER_USE_KEY);
313312
$this->envStore = $env;

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
"symfony/polyfill-php85": "^1.33",
5151
"symfony/string": "^6.4",
5252
"symfony/translation-contracts": "^3.5",
53-
"tinymce/tinymce": "^8.0"
53+
"tinymce/tinymce": "^8.0",
54+
"vlucas/phpdotenv": "^5.6"
5455
},
5556
"require-dev": {
5657
"ext-xmlreader": "*",
@@ -198,4 +199,4 @@
198199
"vendor:patch": "Create patch file",
199200
"test": "Run php-cs-fixer, phpstan & phpunit"
200201
}
201-
}
202+
}

composer.lock

Lines changed: 222 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)