From e3fa0c4bc4d9af8b64bbab23005dc480d4936aeb Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 23 Nov 2022 20:16:28 -0500 Subject: [PATCH] refactor: move nginx.conf.sigil files into app-specific directories --- plugins/nginx-vhosts/core-post-deploy | 4 ++-- plugins/nginx-vhosts/core-post-extract | 5 +++-- plugins/nginx-vhosts/functions | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/plugins/nginx-vhosts/core-post-deploy b/plugins/nginx-vhosts/core-post-deploy index 4cd6745eb..f309f5346 100755 --- a/plugins/nginx-vhosts/core-post-deploy +++ b/plugins/nginx-vhosts/core-post-deploy @@ -18,8 +18,8 @@ trigger-nginx-vhosts-core-post-deploy() { if [[ "$HAS_NETWORK_CONFIG" == "true" ]]; then plugn trigger domains-setup "$APP" nginx_build_config "$APP" - if [[ -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/$APP-$DOKKU_PID.nginx.conf.sigil" ]]; then - mv "${DOKKU_LIB_ROOT}/data/nginx-vhosts/$APP-$DOKKU_PID.nginx.conf.sigil" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/$APP-nginx.conf.sigil" + if [[ -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil.$DOKKU_PID" ]]; then + mv "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil.$DOKKU_PID" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil" fi fi } diff --git a/plugins/nginx-vhosts/core-post-extract b/plugins/nginx-vhosts/core-post-extract index d980b755c..a6af25f07 100755 --- a/plugins/nginx-vhosts/core-post-extract +++ b/plugins/nginx-vhosts/core-post-extract @@ -20,8 +20,9 @@ trigger-nginx-vhosts-core-post-extract() { return fi - rm -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/$APP-$DOKKU_PID.nginx.conf.sigil" - cp -f "$CONF_SIGIL_PATH" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/$APP-$DOKKU_PID.nginx.conf.sigil" + mkdir -p "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP" + 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 } diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 235ea7198..ac493a9e4 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -190,10 +190,10 @@ get_custom_nginx_template() { return fi - if [[ -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/$APP-$DOKKU_PID.nginx.conf.sigil" ]]; then - cp "${DOKKU_LIB_ROOT}/data/nginx-vhosts/$APP-$DOKKU_PID.nginx.conf.sigil" "$DESTINATION_FILE" - elif [[ -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/$APP-nginx.conf.sigil" ]]; then - cp "${DOKKU_LIB_ROOT}/data/nginx-vhosts/$APP-nginx.conf.sigil" "$DESTINATION_FILE" + if [[ -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil.$DOKKU_PID" ]]; then + cp "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil.$DOKKU_PID" "$DESTINATION_FILE" + elif [[ -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil" ]]; then + cp "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil" "$DESTINATION_FILE" fi }