Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 04:45:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 04:45:44 +0300
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /lib/object_storage
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'lib/object_storage')
-rw-r--r--lib/object_storage/config.rb26
-rw-r--r--lib/object_storage/direct_upload.rb8
2 files changed, 30 insertions, 4 deletions
diff --git a/lib/object_storage/config.rb b/lib/object_storage/config.rb
index d0777914cb5..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?
@@ -54,12 +68,18 @@ module ObjectStorage
end
# End AWS-specific options
+ # Begin Azure-specific options
+ def azure_storage_domain
+ credentials[:azure_storage_domain]
+ end
+ # End Azure-specific options
+
def google?
- provider == 'Google'
+ provider == GOOGLE_PROVIDER
end
def azure?
- provider == 'AzureRM'
+ provider == AZURE_PROVIDER
end
def fog_attributes
diff --git a/lib/object_storage/direct_upload.rb b/lib/object_storage/direct_upload.rb
index 90199114f2c..b5864382299 100644
--- a/lib/object_storage/direct_upload.rb
+++ b/lib/object_storage/direct_upload.rb
@@ -99,12 +99,18 @@ module ObjectStorage
ObjectStorage: {
Provider: 'AzureRM',
GoCloudConfig: {
- URL: "azblob://#{bucket_name}"
+ URL: azure_gocloud_url
}
}
}
end
+ def azure_gocloud_url
+ url = "azblob://#{bucket_name}"
+ url += "?domain=#{config.azure_storage_domain}" if config.azure_storage_domain.present?
+ url
+ end
+
def use_workhorse_s3_client?
return false unless Feature.enabled?(:use_workhorse_s3_client, default_enabled: true)
return false unless config.use_iam_profile? || config.consolidated_settings?