Sha256: 164c4d8b30758f932b3a5b954b95312b8ac7fc466731c487232d10df8ab249a8

Contents?: true

Size: 747 Bytes

Versions: 8

Compression:

Stored size: 747 Bytes

Contents

require 'fog'
require 'active_support/core_ext/hash/slice'
require 'active_support/core_ext/hash/reverse_merge'
require 'guignol/configuration'

module Guignol
  # Pool Fog connections to minimize latency
  module Connection
    def self.get(options)
      @connections ||= {}
      @connections[options] ||= Fog::Compute.new(options)
    end


    private


    # Find and return credentials
    def credentials
      if ENV['AWS_SECRET_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY']
        {
          :aws_access_key_id     => ENV['AWS_SECRET_KEY_ID'],
          :aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
        }
      else
        Guignol.configuration.slice(:aws_access_key_id, :aws_secret_access_key)
      end
    end


  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
guignol-0.3.6 lib/guignol/connection.rb
guignol-0.3.5.1 lib/guignol/connection.rb
guignol-0.3.5 lib/guignol/connection.rb
guignol-0.3.4 lib/guignol/connection.rb
guignol-0.3.3 lib/guignol/connection.rb
guignol-0.3.2 lib/guignol/connection.rb
guignol-0.3.1 lib/guignol/connection.rb
guignol-0.3.0 lib/guignol/connection.rb