From cc90f67b0794f310e22cb252799632d0e464a053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20H=C3=B6gberg?= Date: Fri, 24 May 2019 09:21:44 +0200 Subject: [PATCH] Option to configure endpoint for DynamoDB This commit adds the option to configure the DynamoDBClient that is used for cache This is done by passing the `endpoint` propery in the config for cache stores. When passing `null` or not passing the propery at all the default AWS endpoint is used. This solves https://github.com/laravel/ideas/issues/1654 --- src/Illuminate/Cache/CacheManager.php | 1 + tests/Integration/Cache/DynamoDbStoreTest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Illuminate/Cache/CacheManager.php b/src/Illuminate/Cache/CacheManager.php index ecd51eeaaa4b..8c72c8146e31 100755 --- a/src/Illuminate/Cache/CacheManager.php +++ b/src/Illuminate/Cache/CacheManager.php @@ -229,6 +229,7 @@ protected function createDynamodbDriver(array $config) $dynamoConfig = [ 'region' => $config['region'], 'version' => 'latest', + 'endpoint' => $config['endpoint'] ?? null, ]; if ($config['key'] && $config['secret']) { diff --git a/tests/Integration/Cache/DynamoDbStoreTest.php b/tests/Integration/Cache/DynamoDbStoreTest.php index c0fc245368a6..908af0526d65 100644 --- a/tests/Integration/Cache/DynamoDbStoreTest.php +++ b/tests/Integration/Cache/DynamoDbStoreTest.php @@ -82,6 +82,7 @@ protected function getEnvironmentSetUp($app) 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => 'us-east-1', 'table' => env('DYNAMODB_CACHE_TABLE', 'laravel_test'), + 'endpoint' => env('DYNAMODB_ENDPOINT'), ]); } }