Module: AutoReconfiguration::AwsS3

Defined in:
lib/cf-autoconfig/blob/aws_s3.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
# File 'lib/cf-autoconfig/blob/aws_s3.rb', line 7

def self.included( base )
  base.send(:alias_method, :original_connect, :connect)
  base.send(:alias_method, :connect, :connect_with_cf )
end

Instance Method Details

#connect_with_cf(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/cf-autoconfig/blob/aws_s3.rb', line 12

def connect_with_cf(options = {})
  service_names = CFRuntime::CloudApp.service_names_of_type('blob')
  if service_names.length == 1
    puts "Auto-reconfiguring AWS-S3"
    options = CFRuntime::AWSS3Client.options_for_svc(service_names[0],options)
  else
    puts "Found #{service_names.length} blob services. Skipping auto-reconfiguration."
  end
  original_connect options
end