module FlapjackConfigurator

Flapjack Configuration Module

Define the gem version

Constants

VERSION

Public Class Methods

configure_flapjack(config, api_base_url = 'http://127.0.0.1:3081', logger = Logger.new(STDOUT), enable_all_entity = true) click to toggle source

Method to configure flapjack

# File lib/flapjack_configurator.rb, line 11
def self.configure_flapjack(config, api_base_url = 'http://127.0.0.1:3081', logger = Logger.new(STDOUT), enable_all_entity = true)
  ret_val = false
  Flapjack::Diner.base_uri(api_base_url)

  # The underlying classes treat the Flapjack::Diner module as if it is a class.
  # This was done as it was fairly natural and will allow Flapjack::Diner to be
  # replaced or wrapped very easily in the future.
  config_obj = FlapjackConfig.new(config, Flapjack::Diner, logger)

  if enable_all_entity
    # Ensure the ALL entity is present
    ret_val = true if config_obj.add_all_entity
  end

  # Update the contacts
  # This will update media, PD creds, notification rules, and entity associations
  #   as they're associated to the contact.
  ret_val = true if config_obj.update_contacts

  return ret_val
end
load_config(file_list, logger) click to toggle source

Helper to load and merge config yaml files

# File lib/flapjack_configurator.rb, line 34
def self.load_config(file_list, logger)
  config = {}
  file_list.each do |file_name|
    logger.debug("Loading config file #{file_name}")
    config.deep_merge!(YAML.load_file(file_name))
  end

  return config
end