Skip to content

Commit

Permalink
Cache env config values as well
Browse files Browse the repository at this point in the history
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
  • Loading branch information
MorrisJobke committed Mar 23, 2017
1 parent 6198b22 commit 29245e6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/private/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,17 @@ public function getKeys() {
* @return mixed the value or $default
*/
public function getValue($key, $default = null) {
$envValue = getenv(self::ENV_PREFIX . $key);
if ($envValue !== false) {
return $envValue;
}

if (isset($this->cache[$key])) {
return $this->cache[$key];
}

$envValue = getenv(self::ENV_PREFIX . $key);
if ($envValue !== false) {
$this->cache[$key] = $envValue;
return $envValue;
}

return $default;
}

Expand Down

0 comments on commit 29245e6

Please sign in to comment.