Browse Source

use local disk storage for dev file upload

pull/1091/head
Phil Lee 3 years ago
parent
commit
95f075e849
  1. 13
      app/models/forms/bulk_upload_sales/upload_your_file.rb

13
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
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

Loading…
Cancel
Save