Fix issue where VHOST was not properly being set

The URL file is being rewritten on every deploy by `dokku deploy` and thus that file was incorrect. Instead, we just reuse the old logic from the nginx-vhosts plugin to handle creation of the VHOST file
This commit is contained in:
Jose Diaz-Gonzalez
2014-12-11 02:09:54 -05:00
parent 4955f9c600
commit 9111902542

View File

@@ -19,22 +19,18 @@ case "$1" in
if [[ ! -f $VHOST_PATH ]]; then
echo "-----> Creating new $VHOST_PATH..."
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
cat "$DOKKU_ROOT/$APP/URL" > $VHOST_PATH
else
VHOST=$(< "$DOKKU_ROOT/VHOST")
SUBDOMAIN=${APP/%\.${VHOST}/}
hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST)
if [[ ! -n $hostname ]]; then
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
hostname="${APP/\//-}"
else
hostname="${APP/\//-}.$VHOST"
fi
VHOST=$(< "$DOKKU_ROOT/VHOST")
SUBDOMAIN=${APP/%\.${VHOST}/}
hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST)
if [[ ! -n $hostname ]]; then
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
hostname="${APP/\//-}"
else
hostname="${APP/\//-}.$VHOST"
fi
echo $hostname > $VHOST_PATH
fi
echo $hostname > $VHOST_PATH
fi
;;