Skip to content

Commit

Permalink
fix: switch from explode to substr (faster)
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
  • Loading branch information
joshtrichards authored and backportbot[bot] committed Sep 16, 2024
1 parent 80bbffa commit 75555d3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/private/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,10 @@ private function readData() {
// grab any "NC_" environment variables
$envRaw = getenv();
// only save environment variables prefixed with "NC_" in the cache
$envPrefixLen = strlen(self::ENV_PREFIX);
foreach ($envRaw as $rawEnvKey => $rawEnvValue) {
if (str_starts_with($rawEnvKey, self::ENV_PREFIX)) {
$realKey = explode(self::ENV_PREFIX, $rawEnvKey)[1];
$realKey = substr($rawEnvKey, $envPrefixLen);
$this->envCache[$realKey] = $rawEnvValue;
}
}
Expand Down

0 comments on commit 75555d3

Please sign in to comment.