Warn if their CDN URL doesn't have a protocol

This can be confusing:
https://meta.discourse.org/t/discourse-cdn-url-breaks-rebuild-restore/136844
This commit is contained in:
Robin Ward 2020-03-05 15:37:49 -05:00
parent 670b855f94
commit 9ab2a15691
1 changed files with 3 additions and 0 deletions

View File

@ -35,6 +35,9 @@ unless Rails.env.test? && ENV['LOAD_PLUGINS'] != "1"
require_relative '../lib/custom_setting_providers' require_relative '../lib/custom_setting_providers'
end end
GlobalSetting.load_defaults GlobalSetting.load_defaults
if GlobalSetting.try(:cdn_url).present? && GlobalSetting.cdn_url !~ /^https?:\/\//
STDERR.puts "WARNING: Your CDN URL does not begin with a protocol like `https://` - this is probably not going to work"
end
if ENV['SKIP_DB_AND_REDIS'] == '1' if ENV['SKIP_DB_AND_REDIS'] == '1'
GlobalSetting.skip_db = true GlobalSetting.skip_db = true