File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -83,9 +83,11 @@ Add dynamodb configs to config/database.php:
83
83
84
84
'dynamodb' => [
85
85
'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'),
89
91
],
90
92
91
93
...
Original file line number Diff line number Diff line change @@ -74,15 +74,25 @@ protected function createClient(array $config)
74
74
$ dynamoConfig = [
75
75
'region ' => $ config ['region ' ],
76
76
'version ' => 'latest ' ,
77
+ 'endpoint ' => $ config ['endpoint ' ] ?? null ,
77
78
];
78
79
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
+
79
90
if (isset ($ config ['key ' ]) && isset ($ config ['secret ' ])) {
80
91
$ dynamoConfig ['credentials ' ] = Arr::only (
81
92
$ config , ['key ' , 'secret ' , 'token ' ]
82
93
);
83
94
}
84
95
85
-
86
96
return (new AwsSdk ($ dynamoConfig ))->createDynamoDb ();
87
97
}
88
98
You can’t perform that action at this time.
0 commit comments