Sha256: 74b94b804c567e30b562f82e1f2a67417b0a9685bd6c89704b88aa8054116687

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

require 'mongo'

class MongoConfig
  
  def self.GetGridFS
    db = GetMongoDatabase()
    Mongo::Grid.new db
  end

  def self.GetMongoDatabase 
    config = {:server => "localhost",:db => "koda"}

    if ENV['MONGOLAB_URI']
  	  uri = URI.parse(ENV['MONGOLAB_URI'])
      conn = Mongo::Connection.from_uri(ENV['MONGOLAB_URI'])
      conn.db(uri.path.gsub(/^\//, ''))
    else
  	  Mongo::Connection.new(config[:server],config[:port] || 27017).db(config[:db])
  	end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
koda-0.0.12 lib/models/mongo_config.rb