refactor
This commit is contained in:
		| @@ -21,7 +21,6 @@ | ||||
| */ | ||||
| #ifndef INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_ | ||||
| #define INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_ | ||||
| #if defined(PROJECT_ENABLE_S3) | ||||
|  | ||||
| #include "providers/base_provider.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| @@ -138,5 +137,4 @@ public: | ||||
| }; | ||||
| } // namespace repertory | ||||
|  | ||||
| #endif // PROJECT_ENABLE_S3 | ||||
| #endif // INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_ | ||||
|   | ||||
| @@ -21,7 +21,6 @@ | ||||
| */ | ||||
| #ifndef INCLUDE_TYPES_S3_HPP_ | ||||
| #define INCLUDE_TYPES_S3_HPP_ | ||||
| #if defined(PROJECT_ENABLE_S3) | ||||
|  | ||||
| #include "types/repertory.hpp" | ||||
| #include "utils/string_utils.hpp" | ||||
|   | ||||
| @@ -33,10 +33,8 @@ static const option display_config_option = {"-dc", "--display_config"}; | ||||
| static const option data_directory_option = {"-dd", "--data_directory"}; | ||||
| static const option encrypt_option = {"-en", "--encrypt"}; | ||||
| static const option drive_information_option = {"-di", "--drive_information"}; | ||||
| #if defined(PROJECT_ENABLE_S3) | ||||
| static const option name_option = {"-na", "--name"}; | ||||
| static const option s3_option = {"-s3", "--s3"}; | ||||
| #endif // defined(PROJECT_ENABLE_S3) | ||||
| static const option generate_config_option = {"-gc", "--generate_config"}; | ||||
| static const option get_option = {"-get", "--get"}; | ||||
| static const option get_directory_items_option = {"-gdi", | ||||
| @@ -62,10 +60,8 @@ static const std::vector<option> option_list = { | ||||
|     data_directory_option, | ||||
|     drive_information_option, | ||||
|     encrypt_option, | ||||
| #if defined(PROJECT_ENABLE_S3) | ||||
|     s3_option, | ||||
|     name_option, | ||||
| #endif // defined(PROJECT_ENABLE_S3) | ||||
|     generate_config_option, | ||||
|     get_option, | ||||
|     get_directory_items_option, | ||||
|   | ||||
| @@ -56,13 +56,11 @@ auto create_provider(const provider_type &prov, | ||||
|                                                      config.get_host_config()); | ||||
|     return std::make_unique<sia_provider>(config, *comm); | ||||
|   } | ||||
| #if defined(PROJECT_ENABLE_S3) | ||||
|   case provider_type::s3: { | ||||
|     create_comm<i_http_comm, curl_comm, s3_config>(comm, | ||||
|                                                    config.get_s3_config()); | ||||
|     return std::make_unique<s3_provider>(config, *comm); | ||||
|   } | ||||
| #endif // defined(PROJECT_ENABLE_S3) | ||||
|   case provider_type::encrypt: { | ||||
|     return std::make_unique<encrypt_provider>(config); | ||||
|   } | ||||
|   | ||||
| @@ -19,8 +19,6 @@ | ||||
|   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
|   SOFTWARE. | ||||
| */ | ||||
| #if defined(PROJECT_ENABLE_S3) | ||||
|  | ||||
| #include "providers/s3/s3_provider.hpp" | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| @@ -887,5 +885,3 @@ auto s3_provider::upload_file_impl(const std::string &api_path, | ||||
|   return api_error::success; | ||||
| } | ||||
| } // namespace repertory | ||||
|  | ||||
| #endif // PROJECT_ENABLE_S3 | ||||
|   | ||||
| @@ -52,11 +52,9 @@ void get_api_authentication_data(std::string &user, std::string &password, | ||||
|  | ||||
| [[nodiscard]] auto | ||||
| get_provider_type_from_args(std::vector<const char *> args) -> provider_type { | ||||
| #if defined(PROJECT_ENABLE_S3) | ||||
|   if (has_option(args, options::s3_option)) { | ||||
|     return provider_type::s3; | ||||
|   } | ||||
| #endif // defined(PROJECT_ENABLE_S3) | ||||
|   if (has_option(args, options::remote_mount_option)) { | ||||
|     return provider_type::remote; | ||||
|   } | ||||
| @@ -138,12 +136,9 @@ auto parse_drive_options( | ||||
|     if ((std::string(args.at(i)) == options::remote_mount_option.at(0U)) || | ||||
|         (std::string(args.at(i)) == options::remote_mount_option.at(1U)) || | ||||
|         (std::string(args.at(i)) == options::data_directory_option.at(0U)) || | ||||
|         (std::string(args.at(i)) == options::data_directory_option.at(1U)) | ||||
| #if defined(PROJECT_ENABLE_S3) | ||||
|         || (std::string(args.at(i)) == options::name_option.at(0U)) || | ||||
|         (std::string(args.at(i)) == options::name_option.at(1U)) | ||||
| #endif // PROJECT_ENABLE_S3 | ||||
|     ) { | ||||
|         (std::string(args.at(i)) == options::data_directory_option.at(1U)) || | ||||
|         (std::string(args.at(i)) == options::name_option.at(0U)) || | ||||
|         (std::string(args.at(i)) == options::name_option.at(1U))) { | ||||
|       i++; | ||||
|       continue; | ||||
|     } | ||||
| @@ -164,12 +159,10 @@ auto parse_drive_options( | ||||
|  | ||||
|       const auto fuse_option_list = utils::string::split(options, ','); | ||||
|       for (const auto &fuse_option : fuse_option_list) { | ||||
| #if defined(PROJECT_ENABLE_S3) | ||||
|         if (fuse_option.find("s3") == 0) { | ||||
|           prov = provider_type::s3; | ||||
|           continue; | ||||
|         } | ||||
| #endif // defined(PROJECT_ENABLE_S3) | ||||
|         if ((fuse_option.find("dd") == 0) || | ||||
|             (fuse_option.find("data_directory") == 0)) { | ||||
|           const auto data = utils::string::split(fuse_option, '='); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user