changeset 6:393fcf337462

AWS: added 3 configurations: Endpoint, ConnectionTimeout, RequestTimeout
author Alain Mazy
date Thu, 09 Jul 2020 10:40:44 +0200
parents 4e326cea533e
children cf1406db08d2 987cb95c1aee
files Aws/AwsS3StoragePlugin.cpp NEWS README.md
diffstat 3 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Aws/AwsS3StoragePlugin.cpp	Fri Jul 03 15:43:20 2020 +0200
+++ b/Aws/AwsS3StoragePlugin.cpp	Thu Jul 09 10:40:44 2020 +0200
@@ -217,6 +217,10 @@
     return nullptr;
   }
 
+  std::string endpoint = pluginSection.GetStringValue("Endpoint", "");
+  unsigned int connectTimeout = pluginSection.GetUnsignedIntegerValue("ConnectTimeout", 30);
+  unsigned int requestTimeout = pluginSection.GetUnsignedIntegerValue("RequestTimeout", 1200);
+
   try
   {
     Aws::SDKOptions options;
@@ -225,6 +229,15 @@
     Aws::Auth::AWSCredentials credentials(accessKey.c_str(), secretKey.c_str());
     Aws::Client::ClientConfiguration configuration;
     configuration.region = region.c_str();
+    configuration.scheme = Aws::Http::Scheme::HTTPS;
+    configuration.connectTimeoutMs = connectTimeout * 1000;
+    configuration.requestTimeoutMs  = requestTimeout * 1000;
+
+    if (!endpoint.empty())
+    {
+      configuration.endpointOverride = endpoint.c_str();
+    }
+
     Aws::S3::S3Client client(credentials, configuration);
 
     OrthancPlugins::LogInfo("AWS S3 storage initialized");
--- a/NEWS	Fri Jul 03 15:43:20 2020 +0200
+++ b/NEWS	Thu Jul 09 10:40:44 2020 +0200
@@ -1,8 +1,7 @@
 Pending changes in the mainline
 ===============================
 
-None
-
+* AWS: added 3 configurations: Endpoint, ConnectionTimeout, RequestTimeout
 
 2020-07-03 - v 0.9.0
 ====================
--- a/README.md	Fri Jul 03 15:43:20 2020 +0200
+++ b/README.md	Thu Jul 09 10:40:44 2020 +0200
@@ -100,6 +100,9 @@
     	"BucketName": "test-orthanc-s3-plugin",
         "Region" : "eu-central-1",
         "AccessKey" : "AKXXX",
-        "SecretKey" : "RhYYYY"
+        "SecretKey" : "RhYYYY",
+        "Endpoint": "",                 // optional: custom endpoint
+        "ConnectionTimeout": 30,        // optional: connection timeout in seconds
+        "RequestTimeout": 1200          // optional: request timeout in seconds (max time to upload/download a file)
     }
 ```
\ No newline at end of file