#!/bin/bash
#
# Federated Computer Network

PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

config_network() {
  echo -ne "\n* Configuring federated network.."
  spin &
  SPINPID=$!

  if [ ! `docker network ls -q --filter name=federated` ]; then  
    docker network create --subnet 172.99.0.0/16 federated &> /dev/null
    [ $? -ne 0 ] && fail "Couldn't run docker network create"
  fi

  echo -ne "done."
  kill -9 $SPINPID &> /dev/null
}
