module Jackal::Utils

Helper utilities

Constants

HTTP_HOOK_CONFIG

Valid configuration paths for hook configuration

Public Class Methods

load_http_hook() click to toggle source

Load the HTTP Hook if configured

@return [TrueClass, FalseClass]

# 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