Sha256: 58ae4c8dd210610f469c50159bd395e0332d82c768b8934084692d0025f98725

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

module NewRelic
  module Binding
    class Config
      def self.endpoint=(url)
        @endpoint = url
        if self.use_ssl? and !self.ssl_supported?
          PlatformLogger.warn('Using SSL is not recommended when using Ruby versions below 1.9')
        end
      end

      def self.use_ssl?
        @endpoint.start_with?('https')
      end

      def self.ssl_supported?
        !(!defined?(RUBY_ENGINE) || (RUBY_ENGINE == 'ruby' && RUBY_VERSION < '1.9.0'))
      end

      def self.skip_ssl_host_verification?
        !@ssl_host_verification
      end

      if self.ssl_supported?
        @endpoint = 'https://platform-api.newrelic.com'
      else
        @endpoint = 'http://platform-api.newrelic.com'
        PlatformLogger.warn('SSL is disabled by default when using Ruby 1.8.x')
      end
      @uri = '/platform/v1/metrics'
      @ssl_host_verification = true
      @poll_cycle_period = 60
      @proxy = nil
      class << self
        attr_accessor :ssl_host_verification, :uri, :poll_cycle_period, :proxy
        attr_reader :endpoint
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newrelic_plugin-1.3.1 lib/newrelic_platform_binding/config.rb
newrelic_plugin-1.3.0 lib/newrelic_platform_binding/config.rb