comparison Aws/AwsS3StoragePlugin.cpp @ 27:e1f52b851827

Added "VirtualAddressing" configuration option in the AWS S3 plugin (for compatibility with minio)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 07 Sep 2020 17:16:38 +0200
parents 2a02b21f0a19
children 70da4ce5c7cc
comparison
equal deleted inserted replaced
26:471eaf5c5d39 27:e1f52b851827
224 } 224 }
225 225
226 std::string endpoint = pluginSection.GetStringValue("Endpoint", ""); 226 std::string endpoint = pluginSection.GetStringValue("Endpoint", "");
227 unsigned int connectTimeout = pluginSection.GetUnsignedIntegerValue("ConnectTimeout", 30); 227 unsigned int connectTimeout = pluginSection.GetUnsignedIntegerValue("ConnectTimeout", 30);
228 unsigned int requestTimeout = pluginSection.GetUnsignedIntegerValue("RequestTimeout", 1200); 228 unsigned int requestTimeout = pluginSection.GetUnsignedIntegerValue("RequestTimeout", 1200);
229 229 bool virtualAddressing = pluginSection.GetBooleanValue("VirtualAddressing", true);
230
230 try 231 try
231 { 232 {
232 Aws::SDKOptions options; 233 Aws::SDKOptions options;
233 Aws::InitAPI(options); 234 Aws::InitAPI(options);
234 235
236 Aws::Client::ClientConfiguration configuration; 237 Aws::Client::ClientConfiguration configuration;
237 configuration.region = region.c_str(); 238 configuration.region = region.c_str();
238 configuration.scheme = Aws::Http::Scheme::HTTPS; 239 configuration.scheme = Aws::Http::Scheme::HTTPS;
239 configuration.connectTimeoutMs = connectTimeout * 1000; 240 configuration.connectTimeoutMs = connectTimeout * 1000;
240 configuration.requestTimeoutMs = requestTimeout * 1000; 241 configuration.requestTimeoutMs = requestTimeout * 1000;
242 configuration.httpRequestTimeoutMs = requestTimeout * 1000;
241 243
242 if (!endpoint.empty()) 244 if (!endpoint.empty())
243 { 245 {
244 configuration.endpointOverride = endpoint.c_str(); 246 configuration.endpointOverride = endpoint.c_str();
245 } 247 }
246 248
247 Aws::S3::S3Client client(credentials, configuration); 249 Aws::S3::S3Client client(credentials, configuration, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never, virtualAddressing);
248 250
249 OrthancPlugins::LogInfo("AWS S3 storage initialized"); 251 OrthancPlugins::LogInfo("AWS S3 storage initialized");
250 252
251 return new AwsS3StoragePlugin(client, bucketName, enableLegacyStorageStructure); 253 return new AwsS3StoragePlugin(client, bucketName, enableLegacyStorageStructure);
252 } 254 }