Sha256: c45df2404dc3d8272349fff7c3cf161b85a9053da3daef19e47e524c6567a6b5

Contents?: true

Size: 857 Bytes

Versions: 7

Compression:

Stored size: 857 Bytes

Contents

require 'fog'

module Microstatic
  module UsesFog
    def check_and_store_aws_creds( aws_creds )
      [:access_key_id,:secret_access_key].each do |required_key|
        raise ArgumentError, "must supply :#{required_key}" unless aws_creds.key?(required_key)
      end

      @aws_creds = aws_creds
    end

    # TODO: rename connection to storage
    def connection
      @_connection ||= Fog::Storage.new({
        :provider => 'AWS',
        :aws_access_key_id => @aws_creds.fetch(:access_key_id),
        :aws_secret_access_key => @aws_creds.fetch(:secret_access_key),
        :path_style => true
      })
    end
    
    def dns
      @_dns ||= Fog::DNS.new({
        :provider => 'AWS',
        :aws_access_key_id => @aws_creds.fetch(:access_key_id),
        :aws_secret_access_key => @aws_creds.fetch(:secret_access_key)
      })
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
microstatic-0.6.0 lib/microstatic/uses_fog.rb
microstatic-0.5.2 lib/microstatic/uses_fog.rb
microstatic-0.5.1 lib/microstatic/uses_fog.rb
microstatic-0.5.0 lib/microstatic/uses_fog.rb
microstatic-0.4.2 lib/microstatic/uses_fog.rb
microstatic-0.4.1 lib/microstatic/uses_fog.rb
microstatic-0.4.0 lib/microstatic/uses_fog.rb