I have two websites running the same version of a CMS I'm working on,
and each site has a small number of minor customizations. The CMS is
built on top of Rails 3 and MongoMapper. I am getting an error every
time I run a (any?) rake command which depends on :environment. The
stack trace (and `heroku logs`) points me to config/initializers/
mongo.rb (contents shown below). I have been using this config
unaltered for quite a while without issue.

As best as I can tell, the problem lies with ENV['MONGOHQ_URL']. Has
ENV['MONGOHQ_URL'] somehow gotten mis-configured? Do I need to remove
MongoHQ configuration and add it back?

# config/initializers/mongo.rb
file_name = Rails.root + 'config' + 'database.yml'

if File.exists? file_name
  y = YAML.load_file(file_name)[Rails.env]
  mongo_url = "mongodb://#{y['host']}#{y['port'].nil? ? '' :
":#{y['port']}"}/#{y['database']}"
end

MongoMapper.config = {
  Rails.env => {
    'uri' => (ENV['MONGOHQ_URL'] ? ENV['MONGOHQ_URL'] : mongo_url)
  }
}

MongoMapper.connect(Rails.env)

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to