Skip to content

Commit f24bb9f

Browse files
author
Pascal Querner
committed
feat: move env variables "str_starts_with"
1 parent 904415d commit f24bb9f

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
@@ -190,7 +190,11 @@ public function setEnvStore(array $envStorage): void
190190
public function getEnv(): array
191191
{
192192
if (empty($this->envStore)) {
193-
$this->envStore = getenv();
193+
$env = getenv();
194+
$env = array_filter($env, function ($key) {
195+
return str_starts_with($key, static::ENV_STARTS_WITH);
196+
}, ARRAY_FILTER_USE_KEY);
197+
$this->envStore = $env;
194198
}
195199
return $this->envStore;
196200
}
@@ -220,10 +224,6 @@ protected function getConfigKey(string $configKey): array
220224

221225
protected function isConfigKeyValid(string $configKey): bool
222226
{
223-
if (!str_starts_with($configKey, static::ENV_STARTS_WITH)) {
224-
return false;
225-
}
226-
227227
$sectionGroupFieldRegexp = sprintf('([%s]*)', implode('', static::ALLOWED_CHARS));
228228
$allowedChars = sprintf('[%s]', implode('', static::ALLOWED_CHARS));
229229
$regexp = '/' . static::ENV_STARTS_WITH . static::ENV_KEY_SEPARATOR . '(WEBSITES' . static::ENV_KEY_SEPARATOR

0 commit comments

Comments
 (0)