X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/08123387faf00b0af64ea01f7196d8c5ca3fae1e..94972ae20fa5d9dde7dc814695a970e9d5bad4a7:/apps/workbench/lib/config_validators.rb diff --git a/apps/workbench/lib/config_validators.rb b/apps/workbench/lib/config_validators.rb index ec769168c2..804e3e3970 100644 --- a/apps/workbench/lib/config_validators.rb +++ b/apps/workbench/lib/config_validators.rb @@ -5,24 +5,22 @@ require 'uri' module ConfigValidators - def validate_wb2_url_config - if Rails.configuration.workbench2_url - begin - if !URI.parse(Rails.configuration.workbench2_url).is_a?(URI::HTTP) - Rails.logger.warn("workbench2_url config is not an HTTP URL: #{Rails.configuration.workbench2_url}") - Rails.configuration.workbench2_url = false - elsif /.*[\/]{2,}$/.match(Rails.configuration.workbench2_url) - Rails.logger.warn("workbench2_url config shouldn't have multiple trailing slashes: #{Rails.configuration.workbench2_url}") - Rails.configuration.workbench2_url = false - else - return true - end - rescue URI::InvalidURIError - Rails.logger.warn("workbench2_url config invalid URL: #{Rails.configuration.workbench2_url}") - Rails.configuration.workbench2_url = false - 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 -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