From 3eadb0ae036900b6b4fe9364e1a618c8f96d8919 Mon Sep 17 00:00:00 2001 From: Eugene Ware Date: Mon, 8 Jul 2013 15:50:17 +1000 Subject: [PATCH 1/2] support for fully qualified domain names --- plugins/nginx-vhosts/post-deploy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index 2b2650369..a8e00df89 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -3,7 +3,7 @@ set -e APP="$1"; PORT="$2" if [[ -f "$HOME/VHOST" ]]; then - hostname="${APP/\//-}.$(< "$HOME/VHOST")" + [[ "$APP" == *.* ]] && hostname="${APP/\//-}" || hostname="${APP/\//-}.$(< "$HOME/VHOST")" cat< $HOME/$APP/nginx.conf upstream $APP { server 127.0.0.1:$PORT; } server { From f4cdc942095d2ec214d9fbe9d1a16fe30ca2c8f9 Mon Sep 17 00:00:00 2001 From: Eugene Ware Date: Mon, 8 Jul 2013 21:12:37 +1000 Subject: [PATCH 2/2] don't use fully qualified name if a subdomain of $HOME/VHOST --- plugins/nginx-vhosts/post-deploy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index a8e00df89..eb5b8928f 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -3,7 +3,13 @@ set -e APP="$1"; PORT="$2" if [[ -f "$HOME/VHOST" ]]; then - [[ "$APP" == *.* ]] && hostname="${APP/\//-}" || hostname="${APP/\//-}.$(< "$HOME/VHOST")" + VHOST=$(< "$HOME/VHOST") + SUBDOMAIN=${APP/%\.${VHOST}/} + if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then + hostname="${APP/\//-}" + else + hostname="${APP/\//-}.$VHOST" + fi cat< $HOME/$APP/nginx.conf upstream $APP { server 127.0.0.1:$PORT; } server {