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 <[email protected]>
  • Loading branch information
joshtrichards committed Jun 27, 2024
1 parent 2102001 commit da697ea
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 @@ -228,9 +228,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 da697ea

Please sign in to comment.