Skip to content

Commit

Permalink
Merge pull request #46 from StephenHynes7/data-endpoint-fix
Browse files Browse the repository at this point in the history
Data endpoint fix
  • Loading branch information
StephenHynes7 committed Feb 12, 2016
2 parents 0b65138 + 9cfc8d8 commit 618ca8f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -79,6 +79,10 @@ a UDP connection. Additionally, when connecting via UDP, be sure to specify a po

Rails.logger = Le.new('', :udp_port => 13287)

Users have the option of using `data.logentries.com` which uses ports 80 and 443 for insecure and secure connections respectively.

Rails.logger = Le.new('', :data_endpoint => true)



Step for setting up DataHub
Expand Down
5 changes: 2 additions & 3 deletions lib/le/host.rb
@@ -1,10 +1,9 @@
module Le
module Host

#! def self.new(token, local, debug, ssl, datahub_enabled, datahub_ip, datahub_port, host_id, host_name_enabled, host_name)
def self.new(token, local, debug, ssl, datahub_endpoint, host_id, custom_host, udp_port)
def self.new(token, local, debug, ssl, datahub_endpoint, host_id, custom_host, udp_port, use_data_endpoint)

Le::Host::HTTP.new(token, local, debug, ssl, datahub_endpoint, host_id, custom_host, udp_port)
Le::Host::HTTP.new(token, local, debug, ssl, datahub_endpoint, host_id, custom_host, udp_port, use_data_endpoint)
end

module InstanceMethods
Expand Down
8 changes: 4 additions & 4 deletions lib/le/host/http.rb
Expand Up @@ -20,10 +20,10 @@ class HTTP

include Le::Host::InstanceMethods
#! attr_accessor :token, :queue, :started, :thread, :conn, :local, :debug, :ssl, :datahub_enabled, :dathub_ip, :datahub_port, :host_id, :custom_host, :host_name_enabled, :host_name
attr_accessor :token, :queue, :started, :thread, :conn, :local, :debug, :ssl, :datahub_enabled, :datahub_ip, :datahub_port, :datahub_endpoint, :host_id, :host_name_enabled, :host_name, :custom_host, :udp_port, :use_datahub_endpoint
attr_accessor :token, :queue, :started, :thread, :conn, :local, :debug, :ssl, :datahub_enabled, :datahub_ip, :datahub_port, :datahub_endpoint, :host_id, :host_name_enabled, :host_name, :custom_host, :udp_port, :use_data_endpoint


def initialize(token, local, debug, ssl, datahub_endpoint, host_id, custom_host, udp_port, use_datahub_endpoint)
def initialize(token, local, debug, ssl, datahub_endpoint, host_id, custom_host, udp_port, use_data_endpoint)
if local
device = if local.class <= TrueClass
if defined?(Rails)
Expand All @@ -41,7 +41,7 @@ def initialize(token, local, debug, ssl, datahub_endpoint, host_id, custom_host,
@debug= debug
@ssl = ssl
@udp_port = udp_port
@use_datahub_endpoint = use_datahub_endpoint
@use_data_endpoint = use_data_endpoint

@datahub_endpoint = datahub_endpoint
if !@datahub_endpoint[0].empty?
Expand Down Expand Up @@ -166,7 +166,7 @@ def close
def openConnection
dbg "LE: Reopening connection to Logentries API server"

if @use_datahub_endpoint
if @use_data_endpoint
host = DATA_ENDPOINT
if @ssl
port = DATA_PORT_SECURE
Expand Down
5 changes: 3 additions & 2 deletions test/host_spec.rb
Expand Up @@ -5,15 +5,16 @@
let(:token) { '11111111-2222-3333-aaaa-bbbbbbbbbbbb' }
let(:local) { false }
let(:debug) { false }
let(:ssl) { false }
let(:ssl) { true }
let(:udp_port){ nil }

let(:datahub_endpoint) { ["", 10000] }
let(:host_id) { ""}
let(:custom_host) { [false, ""]}
let(:data_endpoint) {true}

#let(:host) { Le::Host.new(token, local, debug, ssl) }
let(:host) { Le::Host.new(token, local, debug, ssl, datahub_endpoint, host_id, custom_host, udp_port)}
let(:host) { Le::Host.new(token, local, debug, ssl, udp_port)}
specify { host.must_be_instance_of Le::Host::HTTP }

end

0 comments on commit 618ca8f

Please sign in to comment.