Skip to content
Prev Previous commit
Next Next commit
Update CredentialProvider.php
Add a fall-through in case the $_SERVER variable isn't set (and re-introduce the equivalent change for ENV_SESSION)
  • Loading branch information
paullallier authored Jul 1, 2024
commit 6ac8156b8f618a19a19675fbbbf7ba1160f1f4e1
6 changes: 3 additions & 3 deletions src/Credentials/CredentialProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@ public static function env()
{
return function () {
// Use credentials from environment variables, if available
$key = getenv(self::ENV_KEY) ?: $_SERVER[self::ENV_KEY];
$secret = getenv(self::ENV_SECRET) ?: $_SERVER[self::ENV_SECRET];
$key = getenv(self::ENV_KEY) ?: $_SERVER[self::ENV_KEY] ?? false;
$secret = getenv(self::ENV_SECRET) ?: $_SERVER[self::ENV_SECRET] ?? false;
if ($key && $secret) {
return Promise\Create::promiseFor(
new Credentials($key, $secret, getenv(self::ENV_SESSION) ?: NULL)
new Credentials($key, $secret, getenv(self::ENV_SESSION) ?: $_SERVER[self::ENV_SESSION] ?? NULL)
);
}

Expand Down