A platform for community discussion. Free, open, simple.
Allow `s3:upload_assets` to use site settings from DB take 2.
Guo Xiang Tan68b640f6a9a2
diff --git a/lib/tasks/s3.rake b/lib/tasks/s3.rakeindex 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)endend+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)+ )+ endenddef assets@@ -76,7 +86,7 @@ def asset_pathsenddef ensure_s3_configured!- unless GlobalSetting.use_s3? || ENV["USE_DB_S3_CONFIG"]+ unless GlobalSetting.use_s3? || use_db_s3_configSTDERR.puts "ERROR: Ensure S3 is configured in config/discourse.conf of environment vars"exit 1end