Skip to content

Commit 99a4836

Browse files
author
Pascal Querner
committed
feat: move env variables "str_starts_with"
1 parent 339a060 commit 99a4836

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ public function setEnvStore(array $envStorage): void
197197
public function getEnv(): array
198198
{
199199
if (empty($this->envStore)) {
200-
$this->envStore = getenv();
200+
$env = getenv();
201+
$env = array_filter($env, function ($key) {
202+
return str_starts_with($key, static::ENV_STARTS_WITH);
203+
}, ARRAY_FILTER_USE_KEY);
204+
$this->envStore = $env;
201205
}
202206
return $this->envStore;
203207
}
@@ -227,10 +231,6 @@ protected function getConfigKey(string $configKey): array
227231

228232
protected function isConfigKeyValid(string $configKey): bool
229233
{
230-
if (!str_starts_with($configKey, static::ENV_STARTS_WITH)) {
231-
return false;
232-
}
233-
234234
$sectionGroupFieldRegexp = sprintf('([%s]*)', implode('', static::ALLOWED_CHARS));
235235
$allowedChars = sprintf('[%s]', implode('', static::ALLOWED_CHARS));
236236
$regexp = '/' . static::ENV_STARTS_WITH . static::ENV_KEY_SEPARATOR . '(WEBSITES' . static::ENV_KEY_SEPARATOR

0 commit comments

Comments
 (0)