Module: Jackal::Utils

Extended by:
Constants, Payload
Defined in:
lib/jackal/utils.rb,
lib/jackal/utils/spec.rb,
lib/jackal/utils/config.rb,
lib/jackal/utils/events.rb,
lib/jackal/utils/payload.rb,
lib/jackal/utils/process.rb,
lib/jackal/utils/http_api.rb,
lib/jackal/utils/constants.rb,
lib/jackal/utils/spec/generator.rb,
lib/jackal/utils/spec/callback_local.rb

Overview

Helper utilities

Defined Under Namespace

Modules: Config, Constants, Events, Payload, Spec Classes: HttpApi, Process

Constant Summary collapse

HTTP_HOOK_CONFIG =

Valid configuration paths for hook configuration

[
  [:http_hook],
  [:jackal, :http_hook]
]

Class Method Summary collapse

Methods included from Payload

new_payload, unpack

Methods included from Constants

constantize

Class Method Details

.load_http_hookTrueClass, FalseClass

Load the HTTP Hook if configured

Returns:

  • (TrueClass, FalseClass)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/jackal/utils.rb', line 29

def load_http_hook
  hook_config = HTTP_HOOK_CONFIG.map do |path|
    Carnivore::Config.get(*path)
  end.compact.first
  if(hook_config)
    Carnivore.configure do
      Carnivore::Source.build(
        :type => :http_endpoints,
        :args => {
          :name => :jackal_http_hook,
          :bind => hook_config.fetch(:bind, "0.0.0.0"),
          :port => hook_config.fetch(:port, 8989)
        }
      )
    end
    true
  else
    false
  end
end