lib/rfm/utilities/config.rb in ginjo-rfm-3.0.7 vs lib/rfm/utilities/config.rb in ginjo-rfm-3.0.8
- old
+ new
@@ -5,17 +5,19 @@
# The subsets can be any grouping of defined config parameters, as a hash.
# See CONFIG_KEYS for defined config parameters.
#
module Config
require 'yaml'
+ require 'erb'
CONFIG_KEYS = %w(
file_name
file_path
parser
host
port
+ proxy
account_name
password
database
layout
ignore_bad_data
@@ -121,12 +123,12 @@
# Change file name with :file_name => 'something.else'
# Change file paths with :file_path => ['array/of/', 'file/paths/']
def get_config_file
@@config_file_data ||= (
config_file_name = @config[:file_name] || (RFM_CONFIG[:file_name] rescue nil) || 'rfm.yml'
- config_file_paths = [''] | [(@config[:file_path] || (RFM_CONFIG[:file_path] rescue nil) || %w( config/ ))].flatten
+ config_file_paths = [''] | [(@config[:file_path] || (RFM_CONFIG[:file_path] rescue nil) || %w( config/ ./ ))].flatten
config_file_paths.collect do |path|
- (YAML.load_file(File.join(path, config_file_name)) rescue {})
+ (YAML.load(ERB.new(File.read(File.join(path, config_file_name))).result) rescue {})
end.inject({}){|h,a| h.merge(a)}
) || {}
end
# Get the top-level configuration from yml file and RFM_CONFIG
\ No newline at end of file