From 95f075e849d3c8c29ac2b86a59dcd3c1136efa18 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Thu, 15 Dec 2022 14:20:22 +0000 Subject: [PATCH] use local disk storage for dev file upload --- .../forms/bulk_upload_sales/upload_your_file.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/models/forms/bulk_upload_sales/upload_your_file.rb b/app/models/forms/bulk_upload_sales/upload_your_file.rb index be65144e1..4207287ff 100644 --- a/app/models/forms/bulk_upload_sales/upload_your_file.rb +++ b/app/models/forms/bulk_upload_sales/upload_your_file.rb @@ -38,9 +38,7 @@ module Forms filename: file.original_filename, ) - if upload_enabled? - storage_service.write_file(bulk_upload.identifier, File.read(file.path)) - end + storage_service.write_file(bulk_upload.identifier, File.read(file.path)) ProcessBulkUploadJob.perform_later(bulk_upload:) @@ -50,11 +48,18 @@ module Forms private def upload_enabled? - !Rails.env.development? + FeatureToggle.upload_enabled? end def storage_service - @storage_service ||= Storage::S3Service.new(Configuration::PaasConfigurationService.new, ENV["CSV_DOWNLOAD_PAAS_INSTANCE"]) + @storage_service ||= if upload_enabled? + Storage::S3Service.new( + Configuration::PaasConfigurationService.new, + ENV["CSV_DOWNLOAD_PAAS_INSTANCE"], + ) + else + Storage::LocalDiskService.new + end end def validate_file_is_csv