DEV: Add hidden s3_inventory_bucket_region site setting (#27786)

This commit adds a hidden `s3_inventory_bucket_region` site setting to
specify the region of the `s3_inventory_bucket` when the `S3Inventory`
class initializes an instance of the `S3Helper`. By default, the
`S3Helper` class uses the value of the `s3_region` site setting but the
region of the `s3_inventory_bucket` is not always the same as the
`s3_region` configured.
This commit is contained in:
Alan Guo Xiang Tan
2024-07-09 12:03:43 +08:00
committed by GitHub
parent 7111d5e4bf
commit 86e5f46175
4 changed files with 28 additions and 3 deletions

View File

@ -298,7 +298,13 @@ module FileStore
def list_missing_uploads(skip_optimized: false)
if s3_inventory_bucket = SiteSetting.s3_inventory_bucket
S3Inventory.new(:upload, s3_inventory_bucket:).backfill_etags_and_list_missing
s3_options = {}
if (s3_inventory_bucket_region = SiteSetting.s3_inventory_bucket_region).present?
s3_options[:region] = s3_inventory_bucket_region
end
S3Inventory.new(:upload, s3_inventory_bucket:, s3_options:).backfill_etags_and_list_missing
unless skip_optimized
S3Inventory.new(:optimized, s3_inventory_bucket:).backfill_etags_and_list_missing