#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
dokku-ansible-deploy-post-extract() {
declare APP="$1" TMPDIR="$2"
if [[ -d "$TMPDIR/deploy.d" ]] && [[ "$(ls -A "$TMPDIR/deploy.d")" ]]; then
dokku_col_log_info1_quiet "Copying deploy.d files into place"
mkdir -p "$DOKKU_LIB_ROOT/data/deploy.d/$APP"
cp -r "$TMPDIR/deploy.d/." "$DOKKU_LIB_ROOT/data/deploy.d/$APP"
if [[ -d "$TMPDIR/deploy.d/vault" ]]; then
if [[ ! -f "$DOKKU_LIB_ROOT/data/deploy.d/$APP/.vault-password.sh" ]]; then
dokku_col_log_info1_quiet "Vault folder discovered but missing vault password"
dokku_col_log_info1_quiet "please run dokku dokku-deploy:vault-password $APP"
exit 1
fi
}
dokku-ansible-deploy-post-extract "$@"