MongoMapper now not overrides database name in MONGOHQ_URL configuration if provided. It also works on Heroku.
This commit is contained in:
parent
bb6866fa0f
commit
56ed245db0
2 changed files with 13 additions and 17 deletions
19
.gitignore
vendored
19
.gitignore
vendored
|
|
@ -1,22 +1,21 @@
|
|||
.bundle
|
||||
.DS_Store
|
||||
.idea
|
||||
.rvmrc
|
||||
*.swap
|
||||
*.swp
|
||||
*.swo
|
||||
*.swp
|
||||
*~
|
||||
.bundle
|
||||
bin/*
|
||||
config/app_config.yml
|
||||
config/fb_config.yml
|
||||
config/initializers/secret_token.rb
|
||||
db/*.sqlite3
|
||||
log/*
|
||||
tmp/**/*
|
||||
nbproject
|
||||
gpg/diaspora-development/*.gpg
|
||||
gpg/diaspora-production/*.gpg
|
||||
gpg/*/random_seed
|
||||
public/uploads/*
|
||||
.rvmrc
|
||||
.DS_Store
|
||||
config/app_config.yml
|
||||
bin/*
|
||||
nbproject
|
||||
config/initializers/secret_token.rb
|
||||
public/source.tar
|
||||
config/fb_config.yml
|
||||
tmp/**/*
|
||||
|
|
|
|||
|
|
@ -2,13 +2,10 @@
|
|||
# licensed under the Affero General Public License version 3. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
if ENV['MONGOHQ_URL']
|
||||
MongoMapper.config = {RAILS_ENV => {'uri' => ENV['MONGOHQ_URL']}}
|
||||
else
|
||||
MongoMapper.connection = Mongo::Connection.new(APP_CONFIG['mongo_host'], APP_CONFIG['mongo_port'])
|
||||
end
|
||||
ENV['MONGODB_URL'] = ENV['MONGOHQ_URL'] || URI::Generic.build(:scheme => 'mongodb', :host => APP_CONFIG['mongo_host'], :port => APP_CONFIG['mongo_port'], :path => "/diaspora-#{Rails.env}").to_s
|
||||
|
||||
MongoMapper.database = "diaspora-#{Rails.env}"
|
||||
MongoMapper.config = {RAILS_ENV => {'uri' => ENV['MONGODB_URL']}}
|
||||
MongoMapper.connect RAILS_ENV
|
||||
|
||||
if defined?(PhusionPassenger)
|
||||
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
||||
|
|
@ -16,4 +13,4 @@ if defined?(PhusionPassenger)
|
|||
end
|
||||
end
|
||||
|
||||
Magent.connection = Mongo::Connection.new(APP_CONFIG['mongo_host'], APP_CONFIG['mongo_port'])
|
||||
Magent.connection = MongoMapper.connection
|
||||
|
|
|
|||
Loading…
Reference in a new issue