Sha256: 387a5ed83950e60bf1c00a5aa5eed3df366ab67b9ca0f820af2417615b5fb9c6

Contents?: true

Size: 1.83 KB

Versions: 5

Compression:

Stored size: 1.83 KB

Contents

module Errplane
  class Configuration
    attr_accessor :api_key
    attr_accessor :api_host
    attr_accessor :app_host
    attr_accessor :application_id
    attr_accessor :application_name
    attr_accessor :application_root
    attr_accessor :syslogd_port

    attr_accessor :logger
    attr_accessor :rails_environment
    attr_accessor :framework
    attr_accessor :framework_version
    attr_accessor :language
    attr_accessor :language_version
    attr_accessor :ignored_exceptions
    attr_accessor :ignored_environments
    attr_accessor :environment_variables

    attr_accessor :debug

    DEFAULTS = {
      :api_host => "api.errplane.com",
      :app_host => "app.errplane.com",
      :ignored_exceptions => %w{ActiveRecord::RecordNotFound
                                ActionController::RoutingError},
      :ignored_environments => %w{development test cucumber selenium}
    }

    def initialize
      @api_host = DEFAULTS[:api_host]
      @app_host = DEFAULTS[:app_host]
      @ignored_exceptions = DEFAULTS[:ignored_exceptions].dup
      @ignored_environments = DEFAULTS[:ignored_environments].dup
      @debug = false
    end

    def debug?
      !!@debug
    end

    def ignore_current_environment?
      self.ignored_environments.include?(self.rails_environment)
    end

    def get_logport
      puts "Acquiring port information from errplane"
      http = initialize_http_connection
      response = begin
                   url = "/api/v1/syslogds.txt?api_key=#{@api_key}"
                   http.get(url)
                 rescue Exception => e
                   puts e
                 end


      case response
      when Net::HTTPSuccess
        # Success
        response.body
      else
        # Failure
        ""
      end
    end

    private
    def initialize_http_connection
      Net::HTTP.new(@app_host, "80")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
errplane-0.2.7 lib/errplane/configuration.rb
errplane-0.2.6 lib/errplane/configuration.rb
errplane-0.2.5 lib/errplane/configuration.rb
errplane-0.2.4 lib/errplane/configuration.rb
errplane-0.2.3 lib/errplane/configuration.rb