Sha256: 6d50b925cea1b2b15c1d2fabc270511c2a16afe3b566f0ea627c413cda0f2d36

Contents?: true

Size: 804 Bytes

Versions: 2

Compression:

Stored size: 804 Bytes

Contents

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| fail 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

2 entries across 2 versions & 1 rubygems

Version Path
jackhammer-1.1.0 lib/jackhammer/configuration.rb
jackhammer-1.0.0 lib/jackhammer/configuration.rb