#!/bin/sh
#
# db-copy Cloud hook: import_config
#
# Import config after a database copy.
#
# Usage: import_config.sh site target-env db-name source-env

site="$1"
target_env="$2"
db_name="$3"
source_env="$4"

acsf_file="/mnt/files/$AH_SITE_GROUP.$AH_SITE_ENVIRONMENT/files-private/sites.json"
if [ ! -f $acsf_file ]; then
  echo "$site.$target_env: Importing config"
  drush9 @$site.$target_env config-import sync --yes --partial
  drush9 @$site.$target_env cache-rebuild
fi
