diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-09 21:08:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-09 21:08:33 +0000 |
commit | b296ffa543e23f57fa2692539e6f0028c59e2203 (patch) | |
tree | f5224a37cac088506d1c8fd53925ee1d9fd2a02c /lib/object_storage | |
parent | c172bb9967f280e05bd904188d60a959dff10f00 (diff) | |
download | gitlab-ce-b296ffa543e23f57fa2692539e6f0028c59e2203.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/object_storage')
-rw-r--r-- | lib/object_storage/config.rb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/object_storage/config.rb b/lib/object_storage/config.rb index e91fda29880..cc536ce9b46 100644 --- a/lib/object_storage/config.rb +++ b/lib/object_storage/config.rb @@ -2,12 +2,26 @@ module ObjectStorage class Config + AWS_PROVIDER = 'AWS' + AZURE_PROVIDER = 'AzureRM' + GOOGLE_PROVIDER = 'Google' + attr_reader :options def initialize(options) @options = options.to_hash.deep_symbolize_keys end + def load_provider + if aws? + require 'fog/aws' + elsif google? + require 'fog/google' + elsif azure? + require 'fog/azurerm' + end + end + def credentials @credentials ||= options[:connection] || {} end @@ -30,7 +44,7 @@ module ObjectStorage # AWS-specific options def aws? - provider == 'AWS' + provider == AWS_PROVIDER end def use_iam_profile? @@ -61,11 +75,11 @@ module ObjectStorage # End Azure-specific options def google? - provider == 'Google' + provider == GOOGLE_PROVIDER end def azure? - provider == 'AzureRM' + provider == AZURE_PROVIDER end def fog_attributes |