refactor trigger proxy-build-config from nginx#core-post-deploy

This reduces the duplicated code in the plugin.
This commit is contained in:
Jose Diaz-Gonzalez
2022-11-27 19:50:57 -05:00
parent 9ccd1f397c
commit 348a593ee8
2 changed files with 19 additions and 16 deletions

View File

@@ -14,20 +14,7 @@ trigger-nginx-vhosts-core-post-deploy() {
return
fi
HAS_NETWORK_CONFIG="$(plugn trigger network-config-exists "$APP")"
if [[ "$HAS_NETWORK_CONFIG" == "true" ]]; then
plugn trigger domains-setup "$APP"
nginx_build_config "$APP"
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
if [[ -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil.$DOKKU_PID.missing" ]]; then
rm -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil.$DOKKU_PID.missing"
rm -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil"
fi
else
nginx_clear_config "$APP"
fi
plugn trigger proxy-build-config "$APP"
}
trigger-nginx-vhosts-core-post-deploy "$@"