Class: BackgroundQueue::ClientLib::Config
- Inherits:
-
BackgroundQueue::Config
- Object
- BackgroundQueue::Config
- BackgroundQueue::ClientLib::Config
- Defined in:
- lib/background_queue/client_lib/config.rb
Overview
The client configuration which is stored as a YAML file containing a root key for each environments configuration, much like database.yml.
Example
development:
server:
host: 127.0.0.1
port: 3000
memcache: 127.0.0.1:9999
production:
server:
host: 192.168.3.56
port: 3000
failover:
-
host: 192.168.3.57
port: 3000
-
host: 192.168.3.58
memcache: 192.168.3.1:9999, 192.168.3.3:9999
Defined Under Namespace
Classes: Server
Constant Summary
Constants inherited from BackgroundQueue::Config
BackgroundQueue::Config::DEFAULT_PORT
Instance Attribute Summary collapse
-
#failover ⇒ Object
readonly
an array of failover BackgroundQueue::Config::Server.
-
#memcache ⇒ Object
readonly
an array of Strings defining memcache server address.
-
#server ⇒ Object
readonly
the primary BackgroundQueue::Config::Server.
Class Method Summary collapse
-
.load_hash(env_config, path) ⇒ Object
load the configration using a hash just containing the environment.
Instance Method Summary collapse
-
#initialize(server, failover, memcache) ⇒ Config
constructor
do not call this directly, use a load_* method.
Methods inherited from BackgroundQueue::Config
load_file, load_string, load_yaml
Constructor Details
#initialize(server, failover, memcache) ⇒ Config
do not call this directly, use a load_* method
79 80 81 82 83 |
# File 'lib/background_queue/client_lib/config.rb', line 79 def initialize(server, failover, memcache) @server = server @failover = failover @memcache = memcache end |
Instance Attribute Details
#failover ⇒ Object (readonly)
an array of failover BackgroundQueue::Config::Server
29 30 31 |
# File 'lib/background_queue/client_lib/config.rb', line 29 def failover @failover end |
#memcache ⇒ Object (readonly)
an array of Strings defining memcache server address
31 32 33 |
# File 'lib/background_queue/client_lib/config.rb', line 31 def memcache @memcache end |
#server ⇒ Object (readonly)
the primary BackgroundQueue::Config::Server
27 28 29 |
# File 'lib/background_queue/client_lib/config.rb', line 27 def server @server end |
Class Method Details
.load_hash(env_config, path) ⇒ Object
load the configration using a hash just containing the environment
34 35 36 37 38 39 40 |
# File 'lib/background_queue/client_lib/config.rb', line 34 def self.load_hash(env_config, path) BackgroundQueue::ClientLib::Config.new( build_primary_server_entry(env_config, path), build_failover_server_entries(env_config, path), build_memcache_array(env_config, path) ) end |