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
1 changed files with 6 additions and 5 deletions

View File

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