Skip to content

Instantly share code, notes, and snippets.

@dblock
Created November 9, 2012 14:24
Show Gist options
  • Save dblock/4045973 to your computer and use it in GitHub Desktop.
Save dblock/4045973 to your computer and use it in GitHub Desktop.
MongoHQ configuration for Mongoid 3.x
development:
sessions:
default:
database: mydb_development
hosts:
- localhost:27017
options:
safe: true
test:
sessions:
default:
database: mydb_test
hosts:
- localhost:27017
options:
safe: true
staging:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
options:
consistency: :eventual
safe: true
production:
sessions:
default:
<% if ENV['MONGOHQ_HOST_LIST'] %>
database: <%= ENV['MONGOHQ_DATABASE'] %>
username: <%= ENV['MONGOHQ_USER'] %>
password: <%= ENV['MONGOHQ_PASSWD'] %>
hosts:
<% eval(ENV['MONGOHQ_HOST_LIST']).each do |host_and_port| %>
- <%= host_and_port.join(':') %>
<% end %>
<% elsif ENV['MONGOHQ_URL'] %>
uri: <%= ENV['MONGOHQ_URL'] %>
<% end %>
options:
consistency: :<%= ENV['MONGODB_CONSISTENCY'] || (!$rails_rake_task ? 'eventual' : 'strong') %>
safe: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment