From 71bc198cecb4368979171caf789d7b494f5a190f Mon Sep 17 00:00:00 2001 From: Alexis Tyler Date: Mon, 3 Jul 2017 12:02:49 +0930 Subject: [PATCH] inline nginx migrate function --- plugins/nginx-vhosts/functions | 23 ----------------------- plugins/nginx-vhosts/install | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 9050ab631..3c8b72093 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -350,26 +350,3 @@ nginx_build_config() { fi fi } - -# @TODO: Remove this after a few versions -migrate_nginx_to_proxy() { - declare desc="migrates DOKKU_NGINX_* to DOKKI_PROXY_*" - dokku_log_info1 "Migrating DOKKU_NGINX env variables. The following variables will be migrated" - dokku_log_info2 "DOKKU_NGINX_PORT -> DOKKU_PROXY_PORT" - dokku_log_info2 "DOKKU_NGINX_SSL_PORT -> DOKKU_PROXY_SSL_PORT" - for app in $(dokku_apps); do - local nginx_port="$(config_get "$app" DOKKU_NGINX_PORT || true)" - local nginx_ssl_port="$(config_get "$app" DOKKU_NGINX_SSL_PORT || true)" - if [[ -n "$nginx_port" ]]; then - dokku_log_info1 "Migrating DOKKU_NGINX_PORT to DOKKU_PROXY_PORT for $app" - config_set --no-restart "$app" DOKKU_PROXY_PORT="$nginx_port" - config_unset --no-restart "$app" DOKKU_NGINX_PORT - fi - if [[ -n "$nginx_ssl_port" ]]; then - dokku_log_info1 "Migrating DOKKU_NGINX_SSL_PORT to DOKKU_PROXY_SSL_PORT for $app" - config_set --no-restart "$app" DOKKU_PROXY_SSL_PORT="$nginx_ssl_port" - config_unset --no-restart "$app" DOKKU_NGINX_SSL_PORT - fi - done - dokku_log_info2 "Migration complete" -} diff --git a/plugins/nginx-vhosts/install b/plugins/nginx-vhosts/install index dbda02fbe..a961cd50a 100755 --- a/plugins/nginx-vhosts/install +++ b/plugins/nginx-vhosts/install @@ -1,6 +1,5 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" case "$DOKKU_DISTRO" in debian) @@ -74,7 +73,25 @@ cp "${PLUGIN_CORE_AVAILABLE_PATH}/nginx-vhosts/templates/500-error.html" "${DOKK # patch broken nginx 1.8.0 logrotate [[ -f /etc/logrotate.d/nginx ]] && sed -i -e 's/invoke-rc.d/service/g' /etc/logrotate.d/nginx -migrate_nginx_to_proxy +# @TODO: Remove this after a few versions +dokku_log_info1 "Migrating DOKKU_NGINX env variables. The following variables will be migrated" +dokku_log_info2 "DOKKU_NGINX_PORT -> DOKKU_PROXY_PORT" +dokku_log_info2 "DOKKU_NGINX_SSL_PORT -> DOKKU_PROXY_SSL_PORT" +for app in $(dokku_apps); do + local nginx_port="$(config_get "$app" DOKKU_NGINX_PORT || true)" + local nginx_ssl_port="$(config_get "$app" DOKKU_NGINX_SSL_PORT || true)" + if [[ -n "$nginx_port" ]]; then + dokku_log_info1 "Migrating DOKKU_NGINX_PORT to DOKKU_PROXY_PORT for $app" + config_set --no-restart "$app" DOKKU_PROXY_PORT="$nginx_port" + config_unset --no-restart "$app" DOKKU_NGINX_PORT + fi + if [[ -n "$nginx_ssl_port" ]]; then + dokku_log_info1 "Migrating DOKKU_NGINX_SSL_PORT to DOKKU_PROXY_SSL_PORT for $app" + config_set --no-restart "$app" DOKKU_PROXY_SSL_PORT="$nginx_ssl_port" + config_unset --no-restart "$app" DOKKU_NGINX_SSL_PORT + fi +done +dokku_log_info2 "Migration complete" case "$DOKKU_DISTRO" in debian)