Class: Configuration::S3

Inherits:
Object
  • Object
show all
Includes:
ClassLogging
Defined in:
lib/httpimagestore/configuration/s3.rb

Class Method Summary collapse

Class Method Details

.match(node) ⇒ Object



36
37
38
# File 'lib/httpimagestore/configuration/s3.rb', line 36

def self.match(node)
	node.name == 's3'
end

.parse(configuration, node) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/httpimagestore/configuration/s3.rb', line 40

def self.parse(configuration, node)
	configuration.s3 and raise StatementCollisionError.new(node, 's3')

	node.grab_values
	node.required_attributes('key', 'secret')
	node.valid_attribute_values('ssl', true, false, nil)
	
	key, secret, ssl = node.grab_attributes('key', 'secret', 'ssl')
	ssl = true if ssl.nil?

	configuration.s3 = AWS::S3.new(
		access_key_id: key,
		secret_access_key: secret,
		logger: logger_for(AWS::S3),
		log_level: :debug,
		use_ssl: ssl
	)

	log.info "S3 client using '#{key}' key and #{ssl ? 'HTTPS' : 'HTTP'} connections"
end