diff --git a/lib/tasks/s3.rake b/lib/tasks/s3.rake index 867a9a470cb..34fb4ef6ceb 100644 --- a/lib/tasks/s3.rake +++ b/lib/tasks/s3.rake @@ -37,8 +37,18 @@ def upload(path, remote_path, content_type, content_encoding = nil) end end +def use_db_s3_config + ENV["USE_DB_S3_CONFIG"] +end + def helper - @helper ||= S3Helper.new(GlobalSetting.s3_bucket.downcase, '', S3Helper.s3_options(GlobalSetting)) + @helper ||= begin + setting = use_db_s3_config ? SiteSetting : GlobalSetting + + S3Helper.new( + setting.s3_bucket.downcase, '', S3Helper.s3_options(setting) + ) + end end def assets @@ -76,7 +86,7 @@ def asset_paths end def ensure_s3_configured! - unless GlobalSetting.use_s3? || ENV["USE_DB_S3_CONFIG"] + unless GlobalSetting.use_s3? || use_db_s3_config STDERR.puts "ERROR: Ensure S3 is configured in config/discourse.conf of environment vars" exit 1 end