7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/invision_bridge.rb', line 7
def self.config
if @config.nil?
if Rails
config_file = File.join(Rails.root, 'config', 'database.yml')
config_group = "invision_bridge_#{Rails.env}"
else
config_file = File.join(File.dirname(__FILE__), '..', '..', 'config', 'database.yml')
config_group = "invision_bridge"
end
config = YAML::load(File.open(config_file))
config = config[config_group]
if config.nil?
raise "** [InvisionBridge] Unable to read database configuration from #{config_file} -- Make sure an #{config_group} definition exists."
else
config['prefix'] ||= 'ibf_'
end
@config = config
end
@config
end
|