#!/bin/bash

# manage docker-compose with this macro

if ! [ -d "servers/$HOSTNAME" ]; then
    echo "couldn't find servers/$HOSTNAME"
    exit 1
fi

dc_args="-p $HOSTNAME"
for f in servers/$HOSTNAME/docker-compose.d/*.yml; do
    dc_args="$dc_args -f $f"
done

exec docker-compose $dc_args $@