lib/datapimp/configuration.rb in datapimp-1.0.13 vs lib/datapimp/configuration.rb in datapimp-1.0.14

- old
+ new

@@ -30,10 +30,14 @@ google_client_secret: '', google_refresh_token: '', google_access_token: '' } + def current(using_environment = true) + @current ||= calculate_config(using_environment) + end + def self.method_missing(meth, *args, &block) if instance.respond_to?(meth) return instance.send meth, *args, &block end @@ -121,15 +125,16 @@ def defaults DefaultSettings.dup end - def current(using_environment = true) - @current ||= calculate_config(using_environment) - end - def calculate_config(using_environment = true) @current = defaults.merge(home_config.merge(cwd_config.merge(applied_config))).to_mash + + if ENV['DATAPIMP_CONFIG_EXTRA'].to_s.length > 0 + extra_config = Datapimp::Util.load_config_file(ENV['DATAPIMP_CONFIG_EXTRA']) + @current.merge!(extra_config) if extra_config.is_a?(Hash) + end (defaults.keys + home_config.keys + cwd_config.keys).uniq.each do |key| upper = key.to_s.upcase if ENV[upper] @current[key] = ENV[upper]