development:
  clients:
    default:
      # MONGODB_URI includes draft_content_store_development or content_store_development
      # depending on whether we're running content store in draft mode or not.
      uri: <%= ENV['MONGODB_URI'] || 'mongodb://localhost/content_store_development' %>
      options:
        write:
          w: 1

test:
  clients:
    default:
      uri: mongodb://localhost/content_store_test
      options:
        write:
          w: 1
        # In the test environment we lower the retries and retry interval to
        # low amounts for fast failures.
        max_retries: 1
        retry_interval: 0

production:
  clients:
    default:
      uri: <%= ENV['MONGODB_URI'] %>
      options:
        ssl: <%= ENV['MONGO_SSL'] || 'false' %>
        ssl_verify: <%= ENV['MONGO_SSL_VERIFY'] || 'true' %>
        server_selection_timeout: 5
        write:
          w: <%= ENV['MONGO_WRITE_CONCERN'] || 'majority' %>
        read:
          mode: :secondary_preferred

development:
  clients:
    default:
      # MONGODB_URI includes draft_content_store_development or content_store_development
      # depending on whether we're running content store in draft mode or not.
      uri: <%= ENV['MONGODB_URI'] || 'mongodb://localhost/content_store_development' %>
      options:
        write:
          w: 1

test:
  clients:
    default:
      uri: <%= ENV['TEST_MONGODB_URI'] || 'mongodb://localhost/content_store_test' %>
      options:
        write:
          w: 1
        # In the test environment we lower the retries and retry interval to
        # low amounts for fast failures.
        max_retries: 1
        retry_interval: 0

production:
  clients:
    default:
      uri: <%= ENV['MONGODB_URI'] %>
      options:
        ssl: <%= ENV['MONGO_SSL'] || 'false' %>
        ssl_verify: <%= ENV['MONGO_SSL_VERIFY'] || 'true' %>
        server_selection_timeout: 5
        write:
          w: <%= ENV['MONGO_WRITE_CONCERN'] || 'majority' %>
        read:
          mode: :secondary_preferred

Allow test database to be specified with ENV
Allow test database to be specified with ENV

We currently have to override `mongoid.yml` in govuk-docker, because
the test database URL is hard coded.
