Sha256: 66d945753a9137a936501511e8994426c21a15aa028334467efef200d8a45f55

Contents?: true

Size: 977 Bytes

Versions: 4

Compression:

Stored size: 977 Bytes

Contents

module Jackhammer
  class Configuration
    attr_accessor(
      :app_name,
      :client_middleware,
      :connection_options,
      :connection_url,
      :environment,
      :exception_adapter,
      :logger,
      :publish_options,
      :server,
      :server_middleware,
      :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'
      @client_middleware = MiddlewareCollection.new
      @server_middleware = MiddlewareCollection.new
    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-1.5.1 lib/jackhammer/configuration.rb
jackhammer-1.5.0 lib/jackhammer/configuration.rb
jackhammer-1.5.0.rc lib/jackhammer/configuration.rb
jackhammer-1.4.0 lib/jackhammer/configuration.rb