summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-04-03 18:47:33 +0200
committerKamil Trzciński <ayufan@ayufan.eu>2018-04-05 15:01:14 +0200
commit678620cce67cc283b19b75137f747f9415aaf942 (patch)
tree650b53c790087b88ce40f79c7c66cef6994c25b4 /config
parent9b1677b2deeec1faf0dd1d60a2b0c47e80b58433 (diff)
downloadgitlab-ce-678620cce67cc283b19b75137f747f9415aaf942.tar.gz
Add `direct_upload` setting for artifactsdirect-upload-of-artifacts
Diffstat (limited to 'config')
-rw-r--r--config/initializers/1_settings.rb1
-rw-r--r--config/initializers/artifacts_direct_upload_support.rb7
2 files changed, 8 insertions, 0 deletions
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 6bfbf3b7540..67ca5eae4fb 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -308,6 +308,7 @@ Settings.artifacts['max_size'] ||= 100 # in megabytes
Settings.artifacts['object_store'] ||= Settingslogic.new({})
Settings.artifacts['object_store']['enabled'] = false if Settings.artifacts['object_store']['enabled'].nil?
Settings.artifacts['object_store']['remote_directory'] ||= nil
+Settings.artifacts['object_store']['direct_upload'] = false if Settings.artifacts['object_store']['direct_upload'].nil?
Settings.artifacts['object_store']['background_upload'] = true if Settings.artifacts['object_store']['background_upload'].nil?
Settings.artifacts['object_store']['proxy_download'] = false if Settings.artifacts['object_store']['proxy_download'].nil?
# Convert upload connection settings to use string keys, to make Fog happy
diff --git a/config/initializers/artifacts_direct_upload_support.rb b/config/initializers/artifacts_direct_upload_support.rb
new file mode 100644
index 00000000000..d2bc35ea613
--- /dev/null
+++ b/config/initializers/artifacts_direct_upload_support.rb
@@ -0,0 +1,7 @@
+artifacts_object_store = Gitlab.config.artifacts.object_store
+
+if artifacts_object_store.enabled &&
+ artifacts_object_store.direct_upload &&
+ artifacts_object_store.connection&.provider.to_s != 'Google'
+ raise "Only 'Google' is supported as a object storage provider when 'direct_upload' of artifacts is used"
+end