mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Allow s3:upload_assets
to use site settings from DB take 2.
This commit is contained in:
parent
c56d682f45
commit
68b640f6a9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user