Sha256: 84d5b35b29153212143fb8b52ce7c3cdb577ec0a3176c81b94fdfbf1500671f7

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Meroku
  # Logic related to api keys, passwords
  class Secrets
    attr_reader :cached_aws_access_key_secret, :cached_private_key
    attr_accessor :meroku_secret

    def aws_access_key
      'AKIAIRTTOJ2NSX27XWFA'
    end

    def aws_access_key_secret
      return @cached_aws_access_key_secret if @cached_aws_access_key_secret
      @cached_aws_access_key_secret = download_aws_access_key_secret
      @cached_aws_access_key_secret
    end

    def download_aws_access_key_secret
      bucket = "http://s3.amazonaws.com/#{@meroku_secret}/"
      uri = URI("#{bucket}aws_access_key_secret")
      @cached_aws_access_key_secret = Net::HTTP.get(uri).chomp
      @cached_aws_access_key_secret
    end

    def private_key
      return @cached_private_key if @cached_private_key
      @cached_private_key = download_private_key
      @cached_private_key
    end

    def download_private_key
      uri = URI("http://s3.amazonaws.com/#{@meroku_secret}/meroku.id_rsa")
      @cached_private_key = Net::HTTP.get(uri).chomp
      @cached_private_key
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
meroku-2.0.31 lib/meroku/secrets.rb
meroku-2.0.30 lib/meroku/secrets.rb
meroku-2.0.29 lib/meroku/secrets.rb
meroku-2.0.28 lib/meroku/secrets.rb
meroku-2.0.27 lib/meroku/secrets.rb
meroku-2.0.26 lib/meroku/secrets.rb
meroku-2.0.25 lib/meroku/secrets.rb
meroku-2.0.24 lib/meroku/secrets.rb
meroku-2.0.23 lib/meroku/secrets.rb