#!/bin/bash


set -e

DBNAME="$(relation-get dbname)" || exit 1

MONGO_URL=mongodb://${TARGET_SERVICE_NAME}:27017/${DBNAME}?replicaSet=rs01
MONGO_OPLOG_URL=mongodb://${TARGET_SERVICE_NAME}:27017/local?replicaSet=rs01

config-add "\
services:
  $MASTER_BASE_SERVICE_NAME:
    environment:
      MONGO_URL: $MONGO_URL
      MONGO_OPLOG_URL: $MONGO_OPLOG_URL
"