Created
September 16, 2010 01:52
-
-
Save cmelbye/581833 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/config/initializers/_mongo.rb b/config/initializers/_mongo.rb | |
index 2764f97..88d21ec 100644 | |
--- a/config/initializers/_mongo.rb | |
+++ b/config/initializers/_mongo.rb | |
@@ -2,10 +2,12 @@ | |
# licensed under the Affero General Public License version 3. See | |
# the COPYRIGHT file. | |
+require "uri" | |
-MongoMapper.connection = Mongo::Connection.new('localhost', 27017) | |
+uri = URI.parse(ENV['MONGOHQ_URL']) | |
+MongoMapper.connection = Mongo::Connection.from_uri(ENV['MONGOHQ_URL']) | |
-MongoMapper.database = "diaspora-#{Rails.env}" | |
+MongoMapper.database = uri.path.gsub(/^\//, '') | |
if defined?(PhusionPassenger) | |
PhusionPassenger.on_event(:starting_worker_process) do |forked| |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment