Skip to content

Commit 8e1f620

Browse files
authored
Fix setting DynamoDB credentials (#36822)
1 parent 35e339b commit 8e1f620

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Illuminate/Cache/CacheServiceProvider.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,19 @@ public function register()
3636
$this->app->singleton('cache.dynamodb.client', function ($app) {
3737
$config = $app['config']->get('cache.stores.dynamodb');
3838

39-
return new DynamoDbClient([
39+
$dynamoConfig = [
4040
'region' => $config['region'],
4141
'version' => 'latest',
4242
'endpoint' => $config['endpoint'] ?? null,
43-
'credentials' => Arr::only(
43+
];
44+
45+
if ($config['key'] && $config['secret']) {
46+
$dynamoConfig['credentials'] = Arr::only(
4447
$config, ['key', 'secret', 'token']
45-
),
46-
]);
48+
);
49+
}
50+
51+
return new DynamoDbClient($dynamoConfig);
4752
});
4853
}
4954

0 commit comments

Comments
 (0)