lib/yogi_berra/catcher.rb in yogi_berra-0.0.10 vs lib/yogi_berra/catcher.rb in yogi_berra-0.0.11

- old
+ new

@@ -18,16 +18,27 @@ end if database_config begin File.open(database_config, 'r') do |f| yaml_file = YAML.load(f) - environment = (ENV["YOGI_ENV"] || ENV["RAILS_ENV"] || "test") @@settings = yaml_file["#{environment}"] if yaml_file end rescue YogiBerra::Logger.log("No such file: #{database_config}", :error) end @@settings + end + end + + def environment + if ENV["YOGI_ENV"] + ENV["YOGI_ENV"] + elsif defined?(Rails) + Rails.env + elsif ENV["RAILS_ENV"] + ENV["RAILS_ENV"] + else + "test" end end def db_client(host, port, replica_set = nil) # :w => 0 set the default write concern to 0, this allows writes to be non-blocking \ No newline at end of file