Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added auto-generation of mongoid.yml file
- Loading branch information
Ines Sombra
committed
Apr 13, 2012
1 parent
6428cd7
commit 9f47261
Showing
3 changed files
with
31 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,13 @@ | ||
defaults: &defaults | ||
<% if @solo_server %> | ||
host: localhost | ||
<% else %> | ||
hosts: | ||
<% @mongo_nodes.each do |mongo_node| -%> | ||
- - <%=mongo_node[:hostname]%> | ||
<%=@mongo_port%> | ||
<% end -%> | ||
read_secondary: true | ||
|
||
development: | ||
<<: *defaults | ||
database: winealign_dev | ||
|
||
test: | ||
<<: *defaults | ||
database: winealign_staging | ||
|
||
production: | ||
<<: *defaults | ||
database: winealign_staging | ||
|
||
username: deploy | ||
|
||
|
||
<% end %> | ||
|
||
# If you use Sinatra (or anything other than rails) you need to do make a mongoid.yml like this: | ||
# | ||
# production: | ||
# hosts: [[db1.mongoid.org, 27017], [db2.mongoid.org, 27017]] | ||
# database: project_production | ||
# development: | ||
# hosts: [[db1.mongoid.org, 27017], [db2.mongoid.org, 27017]] | ||
# database: project_development | ||
<%= @environment %>: | ||
database: <%=@mongo_replsetname%> | ||
read_secondary: true | ||
<% if @replica_set -%> | ||
hosts: | ||
<% @hosts.each do |host, port| -%> | ||
- - <%= host %> | ||
- <%= port %> | ||
<% end -%> | ||
<% else -%> | ||
host: <%= @hosts[0][0] %> | ||
port: <%= @hosts[0][1] %> | ||
<% end -%> |