Skip to content

Instantly share code, notes, and snippets.

@devigned
Created May 11, 2017 00:30
Show Gist options
  • Save devigned/2e6627c28b0044ad3d34b6183b4134db to your computer and use it in GitHub Desktop.
Save devigned/2e6627c28b0044ad3d34b6183b4134db to your computer and use it in GitHub Desktop.
Level 1 Mongoid Config
development:
clients:
default:
database: todo_dev
hosts:
- <%= ENV['DB_HOST'] || 'localhost:27017' %>
test:
clients:
default:
database: todo_test
hosts:
- <%= ENV['DB_HOST'] || 'localhost:27017' %>
options:
read:
mode: :primary
max_pool_size: 1
production:
sessions:
default:
options:
ssl: true
clients:
default:
<% if Rails.env.production? %>
<% cosmosdb_name=`az cosmosdb list -g level1 --query "[?starts_with(name, 'level1')] | [0].name" -o tsv`.strip %>
<% conn_strings=JSON.parse(`az cosmosdb list-connection-strings -g level1 -n '#{cosmosdb_name}'`) %>
uri: <%= conn_strings["connectionStrings"][0]["connectionString"] %>
<% end %>
options:
# The default timeout is 5, which is the time in seconds
# for a connection to time out.
# We recommend 15 because it allows for plenty of time
# in most operating environments.
connect_timeout: 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment