FIX: Restore to S3 didn't work without env variables

The `uplaods:migrate_to_s3` rake task should always use the environment variables, because you usually don't want to break your site's uploads during the migration. But restoring a backup should work with site settings as well as environment variables, otherwise you can't restore uploads to S3 from the web interface.
This commit is contained in:
Gerhard Schlager 2020-04-19 20:24:27 +02:00
parent baae0e7446
commit c6b411f6c1
2 changed files with 2 additions and 2 deletions

View File

@ -198,7 +198,7 @@ module FileStore
FileUtils.symlink(source_path, public_upload_path) FileUtils.symlink(source_path, public_upload_path)
FileStore::ToS3Migration.new( FileStore::ToS3Migration.new(
s3_options: FileStore::ToS3Migration.s3_options_from_env, s3_options: FileStore::ToS3Migration.s3_options_from_site_settings,
migrate_to_multisite: Rails.configuration.multisite, migrate_to_multisite: Rails.configuration.multisite,
).migrate ).migrate

View File

@ -21,7 +21,7 @@ module FileStore
def self.s3_options_from_site_settings def self.s3_options_from_site_settings
{ {
client_options: S3Helper.s3_options(SiteSetting), client_options: S3Helper.s3_options(SiteSetting),
bucket: SiteSetting.s3_upload_bucket bucket: SiteSetting.Upload.s3_upload_bucket
} }
end end