#!/bin/sh

if ! [ -d "servers/${1:-$HOSTNAME}" ]; then
    echo "setting up servers/${1:-$HOSTNAME}..."
    cp -r servers/skel/. servers/${1:-$HOSTNAME}
    sed -i "s/localhost/${1:-$HOSTNAME}.ixvd.net/g" servers/${1:-$HOSTNAME}/docker-compose.d/custom/nginx/conf.d/default.conf
    sed -i "s/localhost/${1:-$HOSTNAME}.ixvd.net/g" servers/${1:-$HOSTNAME}/docker-compose.d/docker-compose.yml
    echo "server configuration for \`${1:-$HOSTNAME}\`." >servers/${1:-$HOSTNAME}/README.md
fi