Files
dokku/plugins/nginx-vhosts/core-post-extract

32 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
trigger-nginx-vhosts-core-post-extract() {
declare desc="nginx-vhosts post-extract plugin trigger"
declare trigger="post-extract"
declare APP="$1" SOURCECODE_WORK_DIR="$2"
local CONF_SIGIL_PATH="$(fn-nginx-computed-nginx-conf-sigil-path "$APP")"
pushd "$TMP_WORK_DIR" >/dev/null
mkdir -p "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP"
if [[ -z "$CONF_SIGIL_PATH" ]]; then
touch "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil.$DOKKU_PID.missing"
return
fi
if [[ ! -f "$CONF_SIGIL_PATH" ]]; then
touch "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil.$DOKKU_PID.missing"
return
fi
rm -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil."*
cp -f "$CONF_SIGIL_PATH" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil.$DOKKU_PID"
popd &>/dev/null || pushd "/tmp" >/dev/null
}
trigger-nginx-vhosts-core-post-extract "$@"