Method: RightSupport::Net::S3Helper.init

Defined in:
lib/right_support/net/s3_helper.rb

.init(config, s3, encryptor, options = {}) ⇒ true

Init() is the first method which must be called. This is configuration and integration with S3 and Encryptor

Parameters:

  • config (Hash)

    config for current environment (from YAML config file) creds:

    aws_access_key_id: String
    aws_secret_access_key: String
    

    bucket_name: String master_secret: String

  • s3 (Class)

    Rightscale::S3 class is used to connect to S3

  • encryptor (Class)

    Class which will be used to encrypt data encrypt() and decrypt() methods must be implemented

Returns:

  • (true)

    always returns true

Raises:

  • BucketNotFound if bucket name specified in config does not exist



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/right_support/net/s3_helper.rb', line 58

def self.init(config, s3, encryptor, options = {})
  @config = config
  @s3class = s3
  @encryptor = encryptor
  @options = options

  # Reset any S3 objects we'd been caching, since config may have changed
  @s3 = @bucket = nil
  # Make sure our bucket exists -- better to do it now than on first access!
  self.bucket

  true
end