Method: ActiveStorage::Service::S3Service#initialize

Defined in:
activestorage/lib/active_storage/service/s3_service.rb

#initialize(bucket:, upload: {}, public: false, **options) ⇒ S3Service

Returns a new instance of S3Service.



17
18
19
20
21
22
23
24
25
26
# File 'activestorage/lib/active_storage/service/s3_service.rb', line 17

def initialize(bucket:, upload: {}, public: false, **options)
  @client = Aws::S3::Resource.new(**options)
  @bucket = @client.bucket(bucket)

  @multipart_upload_threshold = upload.delete(:multipart_threshold) || 100.megabytes
  @public = public

  @upload_options = upload
  @upload_options[:acl] = "public-read" if public?
end