Sha256: 61e9c997652104bb0780eb2dda0e0086ac226d8c9976520a68f1ecd233169af2

Contents?: true

Size: 836 Bytes

Versions: 4

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

module Jackhammer
  class Configuration
    attr_accessor(
      :connection_options,
      :connection_url,
      :environment,
      :exception_adapter,
      :logger,
      :publish_options,
      :server,
      :yaml_config
    )

    def initialize
      @connection_options = {}
      @connection_url = ENV['RABBITMQ_URL']
      @environment = ENV['RACK_ENV'] || :development
      @exception_adapter = proc { |e| raise e }
      @logger = Logger.new IO::NULL
      @publish_options = { mandatory: true, persistent: true }
      @yaml_config = './config/jackhammer.yml'
    end

    def self.instance
      @instance ||= new
    end

    def yaml
      environment = Jackhammer.configuration.environment.to_s
      YAML.load_file(Jackhammer.configuration.yaml_config)[environment]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jackhammer-0.2.3 lib/jackhammer/configuration.rb
jackhammer-0.2.2 lib/jackhammer/configuration.rb
jackhammer-0.2.1 lib/jackhammer/configuration.rb
jackhammer-0.2.0 lib/jackhammer/configuration.rb