Class: Workarea::Configuration::S3

Inherits:
Object
  • Object
show all
Defined in:
lib/workarea/configuration/s3.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(slug) ⇒ S3

Returns a new instance of S3.



16
17
18
19
# File 'lib/workarea/configuration/s3.rb', line 16

def initialize(slug)
  @slug = slug
  @config = config.presence || secrets.presence || credentials.presence || {}
end

Class Method Details

.integrationObject



9
10
11
# File 'lib/workarea/configuration/s3.rb', line 9

def integration
  @integration ||= new(:s3_integration)
end

.internalObject



5
6
7
# File 'lib/workarea/configuration/s3.rb', line 5

def internal
  @dragonfly ||= new(:s3)
end

Instance Method Details

#access_key_idObject



29
30
31
# File 'lib/workarea/configuration/s3.rb', line 29

def access_key_id
  ENV["#{prefix}_ACCESS_KEY_ID"].presence || @config[:access_key_id]
end

#bucketObject



25
26
27
# File 'lib/workarea/configuration/s3.rb', line 25

def bucket
  configured_bucket.presence || 'test'
end

#configured?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/workarea/configuration/s3.rb', line 41

def configured?
  configured_bucket.present?
end

#regionObject



21
22
23
# File 'lib/workarea/configuration/s3.rb', line 21

def region
  ENV["#{prefix}_REGION"].presence || @config[:region].presence || 'us-east-1'
end

#secret_access_keyObject



33
34
35
# File 'lib/workarea/configuration/s3.rb', line 33

def secret_access_key
  ENV["#{prefix}_SECRET_ACCESS_KEY"].presence || @config[:secret_access_key]
end

#use_iam_profile?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/workarea/configuration/s3.rb', line 37

def use_iam_profile?
  access_key_id.blank? && secret_access_key.blank?
end