mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 07:27:17 +08:00
FEATURE: Make S3 presigned GET URL expiry configurable (#16912)
Previously we hardcoded the DOWNLOAD_URL_EXPIRES_AFTER_SECONDS const inside S3Helper to be 5 minutes (300 seconds). For various reasons, some hosted sites may need this to be longer for other integrations. The maximum expiry time for presigned URLs is 1 week (which is 604800 seconds), so that has been added as a validation on the setting as well. The setting is hidden because 99% of the time it should not be changed.
This commit is contained in:
@ -124,7 +124,7 @@ describe BackupRestore::S3BackupStore do
|
||||
bucket = Regexp.escape(SiteSetting.s3_backup_bucket)
|
||||
prefix = file_prefix(db_name, multisite)
|
||||
filename = Regexp.escape(filename)
|
||||
expires = S3Helper::DOWNLOAD_URL_EXPIRES_AFTER_SECONDS
|
||||
expires = SiteSetting.s3_presigned_get_url_expires_after_seconds
|
||||
|
||||
/\Ahttps:\/\/#{bucket}.*#{prefix}\/#{filename}\?.*X-Amz-Expires=#{expires}.*X-Amz-Signature=.*\z/
|
||||
end
|
||||
|
Reference in New Issue
Block a user