Sha256: 2b8511cf57e18285aba66c252cc30463031d4415cc6a8c15331df3c0a0c9f135

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

require 'diplomat'
require 'securerandom'

module Skalera
  module Services
    class Errbit
      def self.configure(service_name)
        api_key(service_name)
      end

      def self.config
        Diplomat::Service.get('errbit')
      end

      def self.key_name(service_name)
        "#{service_name}/errbit/key"
      end

      def self.api_key(service_name)
        Diplomat.get(key_name(service_name))
      rescue Diplomat::KeyNotFound
        key = SecureRandom.hex(8)
        puts "created errbit key '#{key}' for service '#{service_name}'"
        Diplomat::Kv.put(key_name(service_name), key)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skalera-services-0.1.0 lib/skalera/services/errbit.rb