lib/onering/config.rb in onering-client-0.0.82 vs lib/onering/config.rb in onering-client-0.0.83
- old
+ new
@@ -1,5 +1,6 @@
+require 'set'
require 'hashlib'
module Onering
class Config
class<<self
@@ -19,12 +20,16 @@
(File.exists?(File.expand_path(i)) rescue false)
}.reverse
# merge all config files with more-specific values overriding less-specific ones
@_config ||= DEFAULT_CONFIG
- @_configfiles.each do |i|
+ @_configfiles_seen ||= Set.new()
+
+ # only load files we haven't seen before
+ (@_configfiles - @_configfiles_seen.to_a).each do |i|
c = YAML.load(File.read(File.expand_path(i))) rescue {}
@_config.deep_merge!(c)
+ @_configfiles_seen << i
end
# settings specified in the library override everything
@_config.deep_merge!(config.compact) unless config.empty?
\ No newline at end of file