Module: Kthxbye::Config

Defined in:
lib/kthxbye/config.rb

Overview

This module handles the setting and retrival of configuration options for Kthxbye.

Constant Summary collapse

DEFAULT =

Default options for Kthxbye

  • redis_server = “127.0.0.1” - the ip to connect to by defaut

  • redis_port = 9876 - default redis port

  • attempts = 1 -default number of attempts on a failing job before a Failure

is generated

  • vervose = false - more output in the worker log

{:redis_server => '127.0.0.1',
:redis_port => 9876,
:attempts => 1,
:verbose => false}.freeze

Class Method Summary collapse

Class Method Details

.optionsObject

Quick access to the options hash. Works for setting individual options during runtime.



30
31
32
33
# File 'lib/kthxbye/config.rb', line 30

def self.options
  return @options if @options
  Config.setup
end

.setup(args = nil) ⇒ Object

This method takes override args input by the user. Can pull from a config/kthxbye.yaml file as well.

NEEDS TO BE REWORKED FOR RAILS APPS



22
23
24
25
26
# File 'lib/kthxbye/config.rb', line 22

def self.setup( args=nil )
  @options ||= DEFAULT.dup
  @options.merge!( YAML.load('./config/kthxbye.yaml') ) if File.exist?( './config/kthxbye.yaml' )
  @options.merge!( args ) if args
end