Class: Workarea::Configuration::S3
- Inherits:
-
Object
- Object
- Workarea::Configuration::S3
- Defined in:
- lib/workarea/configuration/s3.rb
Class Method Summary collapse
Instance Method Summary collapse
- #access_key_id ⇒ Object
- #bucket ⇒ Object
- #configured? ⇒ Boolean
-
#initialize(slug) ⇒ S3
constructor
A new instance of S3.
- #region ⇒ Object
- #secret_access_key ⇒ Object
- #use_iam_profile? ⇒ Boolean
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
.integration ⇒ Object
9 10 11 |
# File 'lib/workarea/configuration/s3.rb', line 9 def integration @integration ||= new(:s3_integration) end |
.internal ⇒ Object
5 6 7 |
# File 'lib/workarea/configuration/s3.rb', line 5 def internal @dragonfly ||= new(:s3) end |
Instance Method Details
#access_key_id ⇒ Object
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 |
#bucket ⇒ Object
25 26 27 |
# File 'lib/workarea/configuration/s3.rb', line 25 def bucket configured_bucket.presence || 'test' end |
#configured? ⇒ Boolean
41 42 43 |
# File 'lib/workarea/configuration/s3.rb', line 41 def configured? configured_bucket.present? end |
#region ⇒ Object
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_key ⇒ Object
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
37 38 39 |
# File 'lib/workarea/configuration/s3.rb', line 37 def use_iam_profile? access_key_id.blank? && secret_access_key.blank? end |