# HG changeset patch # User Sebastien Jodogne # Date 1599491798 -7200 # Node ID e1f52b851827db3f75c2c93f4ff86c4f85e9e635 # Parent 471eaf5c5d3990f986d2265bf793c8d002c84e3b Added "VirtualAddressing" configuration option in the AWS S3 plugin (for compatibility with minio) diff -r 471eaf5c5d39 -r e1f52b851827 Aws/AwsS3StoragePlugin.cpp --- a/Aws/AwsS3StoragePlugin.cpp Mon Sep 07 16:00:59 2020 +0200 +++ b/Aws/AwsS3StoragePlugin.cpp Mon Sep 07 17:16:38 2020 +0200 @@ -226,7 +226,8 @@ std::string endpoint = pluginSection.GetStringValue("Endpoint", ""); unsigned int connectTimeout = pluginSection.GetUnsignedIntegerValue("ConnectTimeout", 30); unsigned int requestTimeout = pluginSection.GetUnsignedIntegerValue("RequestTimeout", 1200); - + bool virtualAddressing = pluginSection.GetBooleanValue("VirtualAddressing", true); + try { Aws::SDKOptions options; @@ -238,13 +239,14 @@ configuration.scheme = Aws::Http::Scheme::HTTPS; configuration.connectTimeoutMs = connectTimeout * 1000; configuration.requestTimeoutMs = requestTimeout * 1000; + configuration.httpRequestTimeoutMs = requestTimeout * 1000; if (!endpoint.empty()) { configuration.endpointOverride = endpoint.c_str(); } - Aws::S3::S3Client client(credentials, configuration); + Aws::S3::S3Client client(credentials, configuration, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never, virtualAddressing); OrthancPlugins::LogInfo("AWS S3 storage initialized"); diff -r 471eaf5c5d39 -r e1f52b851827 Common/StoragePlugin.cpp --- a/Common/StoragePlugin.cpp Mon Sep 07 16:00:59 2020 +0200 +++ b/Common/StoragePlugin.cpp Mon Sep 07 17:16:38 2020 +0200 @@ -301,52 +301,60 @@ return -1; } - plugin.reset(StoragePluginFactory::CreateStoragePlugin(orthancConfig)); - - if (plugin.get() == nullptr) + try { - return -1; - } - - const char* pluginSectionName = plugin->GetConfigurationSectionName(); - static const char* const ENCRYPTION_SECTION = "StorageEncryption"; + plugin.reset(StoragePluginFactory::CreateStoragePlugin(orthancConfig)); - if (orthancConfig.IsSection(pluginSectionName)) - { - OrthancPlugins::OrthancConfiguration pluginSection; - orthancConfig.GetSection(pluginSection, pluginSectionName); - - migrationFromFileSystemEnabled = pluginSection.GetBooleanValue("MigrationFromFileSystemEnabled", false); - - if (migrationFromFileSystemEnabled) + if (plugin.get() == nullptr) { - fileSystemRootPath = orthancConfig.GetStringValue("StorageDirectory", "OrthancStorageNotDefined"); - OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + ": migration from file system enabled, source: " + fileSystemRootPath); + return -1; } - objectsRootPath = pluginSection.GetStringValue("RootPath", std::string()); - plugin->SetRootPath(objectsRootPath); + const char* pluginSectionName = plugin->GetConfigurationSectionName(); + static const char* const ENCRYPTION_SECTION = "StorageEncryption"; - if (pluginSection.IsSection(ENCRYPTION_SECTION)) + if (orthancConfig.IsSection(pluginSectionName)) { - OrthancPlugins::OrthancConfiguration cryptoSection; - pluginSection.GetSection(cryptoSection, ENCRYPTION_SECTION); + OrthancPlugins::OrthancConfiguration pluginSection; + orthancConfig.GetSection(pluginSection, pluginSectionName); + + migrationFromFileSystemEnabled = pluginSection.GetBooleanValue("MigrationFromFileSystemEnabled", false); + + if (migrationFromFileSystemEnabled) + { + fileSystemRootPath = orthancConfig.GetStringValue("StorageDirectory", "OrthancStorageNotDefined"); + OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + ": migration from file system enabled, source: " + fileSystemRootPath); + } + + objectsRootPath = pluginSection.GetStringValue("RootPath", std::string()); + plugin->SetRootPath(objectsRootPath); - crypto.reset(EncryptionConfigurator::CreateEncryptionHelpers(cryptoSection)); - cryptoEnabled = crypto.get() != nullptr; + if (pluginSection.IsSection(ENCRYPTION_SECTION)) + { + OrthancPlugins::OrthancConfiguration cryptoSection; + pluginSection.GetSection(cryptoSection, ENCRYPTION_SECTION); + + crypto.reset(EncryptionConfigurator::CreateEncryptionHelpers(cryptoSection)); + cryptoEnabled = crypto.get() != nullptr; + } + + if (cryptoEnabled) + { + OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + ": client-side encryption is enabled"); + } + else + { + OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + ": client-side encryption is disabled"); + } } - if (cryptoEnabled) - { - OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + ": client-side encryption is enabled"); - } - else - { - OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + ": client-side encryption is disabled"); - } + OrthancPluginRegisterStorageArea(context, StorageCreate, StorageRead, StorageRemove); } - - OrthancPluginRegisterStorageArea(context, StorageCreate, StorageRead, StorageRemove); + catch (Orthanc::OrthancException& e) + { + LOG(ERROR) << "Exception while creating the object storage plugin: " << e.What(); + return -1; + } return 0; } diff -r 471eaf5c5d39 -r e1f52b851827 NEWS --- a/NEWS Mon Sep 07 16:00:59 2020 +0200 +++ b/NEWS Mon Sep 07 17:16:38 2020 +0200 @@ -1,6 +1,10 @@ Pending changes in the mainline =============================== +* Allow compilation of the AWS S3 plugin without vcpkg +* Added "VirtualAddressing" configuration option in the AWS S3 plugin (for compatibility with minio) + + 2020-09-07 - v 1.1.0 ====================