Skip to content

Commit 3da013e

Browse files
committed
Update readme too
1 parent dc703c5 commit 3da013e

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ Add dynamodb configs to config/database.php:
8383

8484
'dynamodb' => [
8585
'driver' => 'dynamodb',
86-
'region' => env('AWS_DEFAULT_REGION'),
87-
'access_key' => env('AWS_ACCESS_KEY_ID'),
88-
'secret_key' => env('AWS_SECRET_ACCESS_KEY')
86+
'key' => env('AWS_ACCESS_KEY_ID'),
87+
'secret' => env('AWS_SECRET_ACCESS_KEY'),
88+
'token' => env('AWS_SESSION_TOKEN'),
89+
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
90+
'endpoint' => env('DYNAMODB_ENDPOINT'),
8991
],
9092

9193
...

src/Kitar/Dynamodb/Connection.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,25 @@ protected function createClient(array $config)
7474
$dynamoConfig = [
7575
'region' => $config['region'],
7676
'version' => 'latest',
77+
'endpoint' => $config['endpoint'] ?? null,
7778
];
7879

80+
if ($key = $config['access_key'] ?? null) {
81+
$config['key'] = $key;
82+
unset($config['access_key']);
83+
}
84+
85+
if ($key = $config['secret_key'] ?? null) {
86+
$config['secret'] = $key;
87+
unset($config['secret_key']);
88+
}
89+
7990
if (isset($config['key']) && isset($config['secret'])) {
8091
$dynamoConfig['credentials'] = Arr::only(
8192
$config, ['key', 'secret', 'token']
8293
);
8394
}
8495

85-
8696
return (new AwsSdk($dynamoConfig))->createDynamoDb();
8797
}
8898

0 commit comments

Comments
 (0)