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
|
.bundle
|
||||||
|
.DS_Store
|
||||||
.idea
|
.idea
|
||||||
|
.rvmrc
|
||||||
*.swap
|
*.swap
|
||||||
*.swp
|
|
||||||
*.swo
|
*.swo
|
||||||
|
*.swp
|
||||||
*~
|
*~
|
||||||
.bundle
|
bin/*
|
||||||
|
config/app_config.yml
|
||||||
|
config/fb_config.yml
|
||||||
|
config/initializers/secret_token.rb
|
||||||
db/*.sqlite3
|
db/*.sqlite3
|
||||||
log/*
|
log/*
|
||||||
tmp/**/*
|
nbproject
|
||||||
gpg/diaspora-development/*.gpg
|
gpg/diaspora-development/*.gpg
|
||||||
gpg/diaspora-production/*.gpg
|
gpg/diaspora-production/*.gpg
|
||||||
gpg/*/random_seed
|
gpg/*/random_seed
|
||||||
public/uploads/*
|
public/uploads/*
|
||||||
.rvmrc
|
|
||||||
.DS_Store
|
|
||||||
config/app_config.yml
|
|
||||||
bin/*
|
|
||||||
nbproject
|
|
||||||
config/initializers/secret_token.rb
|
|
||||||
public/source.tar
|
public/source.tar
|
||||||
config/fb_config.yml
|
tmp/**/*
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,10 @@
|
||||||
# licensed under the Affero General Public License version 3. See
|
# licensed under the Affero General Public License version 3. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
if ENV['MONGOHQ_URL']
|
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.config = {RAILS_ENV => {'uri' => ENV['MONGOHQ_URL']}}
|
|
||||||
else
|
|
||||||
MongoMapper.connection = Mongo::Connection.new(APP_CONFIG['mongo_host'], APP_CONFIG['mongo_port'])
|
|
||||||
end
|
|
||||||
|
|
||||||
MongoMapper.database = "diaspora-#{Rails.env}"
|
MongoMapper.config = {RAILS_ENV => {'uri' => ENV['MONGODB_URL']}}
|
||||||
|
MongoMapper.connect RAILS_ENV
|
||||||
|
|
||||||
if defined?(PhusionPassenger)
|
if defined?(PhusionPassenger)
|
||||||
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
||||||
|
|
@ -16,4 +13,4 @@ if defined?(PhusionPassenger)
|
||||||
end
|
end
|
||||||
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