#!/bin/bash

set -euo pipefail

die() {
  echo "ERROR: $*" >&2
  exit 1
}

if [[ -z "${SCENARIO_NAME}" ]]; then
  die "ERROR: Missing mandatory environment variable '\$SCENARIO_NAME', exiting."
fi

TTS_DIR="/ngcp-data/ngcp-upgrade/${SCENARIO_NAME}/customtt_patchtt"

if [[ ! -d "${TTS_DIR}" ]]; then
  echo "No directory ${TTS_DIR} found"
  echo "So no customtt/patchtt files to place, exiting..."
  exit 0
fi

scp -r "${TTS_DIR}/*" /ngcp-fallback/etc/ngcp-config/templates/
