Updated console to default ENV parameters

This commit is contained in:
Adrian Madrid 2008-12-29 15:16:35 -07:00
parent e6fb6b75bf
commit 7719ac65b2

View File

@ -9,12 +9,13 @@ require 'mongo'
include XGen::Mongo::Driver
host = org_argv[0] || 'localhost'
port = org_argv[1] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
db_name = org_argv[2] || 'ruby-mongo-console'
host = org_argv[0] || ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
port = org_argv[1] || ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
dbnm = org_argv[2] || ENV['MONGO_RUBY_DRIVER_DB'] || 'ruby-mongo-console'
puts "Connecting to #{host}:#{port} on DB for #{db_name}"
DB = Mongo.new(host, port).db(db_name)
puts "Connecting to #{host}:#{port} (CONN) on with database #{dbnm} (DB)"
CONN = Mongo.new(host, port)
DB = CONN.db(dbnm)
puts "Starting IRB session..."
IRB.start(__FILE__)