Class: Saseo::Config
- Inherits:
-
Object
show all
- Includes:
- Defaults
- Defined in:
- lib/saseo/config.rb,
lib/saseo/config/defaults.rb
Defined Under Namespace
Modules: Defaults
Constant Summary
collapse
- ENV_PREFIX =
'SASEO'
Constants included
from Defaults
Defaults::CONSUMER_PHILOTIC_SUBSCRIPTION, Defaults::DATABASE_CONFIG_PATH, Defaults::DATABASE_URL, Defaults::IGNORE_FIELDS_CONFIG_PATH, Defaults::PUBLISHER_BATCH_SIZE, Defaults::SOURCE_DATABASE_CONFIG_PATH, Defaults::SOURCE_DATABASE_URL, Defaults::SOURCE_TABLE_NAME, Defaults::SOURCE_TABLE_SCHEMA, Defaults::TABLE_NAME
Instance Method Summary
collapse
Methods included from Defaults
#defaults, included
Constructor Details
#initialize(config = {}) ⇒ Config
Returns a new instance of Config.
13
14
15
|
# File 'lib/saseo/config.rb', line 13
def initialize(config={})
load_config config
end
|
Instance Method Details
#consumer_philotic_subscription ⇒ Object
33
34
35
|
# File 'lib/saseo/config.rb', line 33
def consumer_philotic_subscription
@consumer_philotic_subscription ||= _load_json_config :consumer_philotic_subscription
end
|
#env ⇒ Object
17
18
19
|
# File 'lib/saseo/config.rb', line 17
def env
ENV['SASEO_ENV'] || ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
end
|
#load_config(config) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/saseo/config.rb', line 21
def load_config(config)
config.each do |k, v|
mutator = "#{k}="
public_send(mutator, v) if respond_to? mutator
end
end
|
#load_file(filename, env = 'development') ⇒ Object
28
29
30
31
|
# File 'lib/saseo/config.rb', line 28
def load_file(filename, env = 'development')
config = YAML.load_file(filename)
load_config(config[env])
end
|