18004: Adds test exposing the race condition.
[arvados.git] / apps / workbench / lib / config_validators.rb
index 54f4b6db8c311c1827acc7edd2943f37db862f12..804e3e397015bd9706d978c3067f805645a88aeb 100644 (file)
@@ -5,18 +5,22 @@
 require 'uri'
 
 module ConfigValidators
-    def self.validate_wb2_url_config
-        if Rails.configuration.Services.Workbench2.ExternalURL != URI("")
-          if !Rails.configuration.Services.Workbench2.ExternalURL.is_a?(URI::HTTP)
-            Rails.logger.warn("workbench2_url config is not an HTTP URL: #{Rails.configuration.Services.Workbench2.ExternalURL}")
-            Rails.configuration.Services.Workbench2.ExternalURL = URI("")
-          elsif /.*[\/]{2,}$/.match(Rails.configuration.Services.Workbench2.ExternalURL.to_s)
-            Rails.logger.warn("workbench2_url config shouldn't have multiple trailing slashes: #{Rails.configuration.Services.Workbench2.ExternalURL}")
-            Rails.configuration.Services.Workbench2.ExternalURL = URI("")
-          else
-            return true
-          end
-        end
-        return false
+  def self.validate_wb2_url_config
+    if Rails.configuration.Services.Workbench2.ExternalURL != URI("")
+      if !Rails.configuration.Services.Workbench2.ExternalURL.is_a?(URI::HTTP)
+        raise "workbench2_url config is not an HTTP URL: #{Rails.configuration.Services.Workbench2.ExternalURL}"
+      elsif /.*[\/]{2,}$/.match(Rails.configuration.Services.Workbench2.ExternalURL.to_s)
+        raise "workbench2_url config shouldn't have multiple trailing slashes: #{Rails.configuration.Services.Workbench2.ExternalURL}"
+      else
+        return true
+      end
     end
+    return false
+  end
+
+  def self.validate_download_config
+    if Rails.configuration.Services.WebDAV.ExternalURL == URI("") and Rails.configuration.Services.WebDAVDownload.ExternalURL == URI("")
+      raise "Keep-web service must be configured in Services.WebDAV and/or Services.WebDAVDownload"
+    end
+  end
 end