Merge pull request #1402 from progrium/jg-consolidate-config

Consolidate config
This commit is contained in:
Jose Diaz-Gonzalez
2015-09-01 16:39:33 -04:00
11 changed files with 265 additions and 206 deletions

View File

@@ -1,13 +1,14 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
source "$PLUGIN_PATH/config/functions"
case "$1" in
build)
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
CACHE_DIR="$DOKKU_ROOT/$APP/cache"
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source "$DOKKU_ROOT/$APP/ENV"
eval "$(config_export app $APP)"
pushd "$TMP_WORK_DIR" &> /dev/null
case "$IMAGE_SOURCE_TYPE" in
@@ -41,7 +42,7 @@ case "$1" in
dockerfile)
# extract first port from Dockerfile
DOCKERFILE_PORT=$(get_dockerfile_exposed_port Dockerfile)
[[ -n "$DOCKERFILE_PORT" ]] && dokku config:set --no-restart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
[[ -n "$DOCKERFILE_PORT" ]] && config_set --no-restart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
pluginhook pre-build-dockerfile "$APP"
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
@@ -65,13 +66,13 @@ case "$1" in
# *DEPRECATED* in v0.3.22: `pluginhook pre-release-buildstep` will be removed in future releases
pluginhook pre-release-buildstep "$APP"
pluginhook pre-release-buildpack "$APP"
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh" < "$DOKKU_ROOT/ENV")
if [[ -n $(config_export global) ]]; then
id=$(config_export global | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
fi
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh" < "$DOKKU_ROOT/$APP/ENV")
if [[ -n $(config_export app $APP) ]]; then
id=$(config_export app $APP | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh")
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
fi
@@ -185,7 +186,7 @@ case "$1" in
verify_app_name "$2"
APP="$2";
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source "$DOKKU_ROOT/$APP/ENV"
eval "$(config_export app $APP)"
if [[ -s "$DOKKU_ROOT/$APP/URLS" ]]; then
case "$1" in

View File

@@ -1,22 +1,26 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
source "$PLUGIN_PATH/config/functions"
APP="$1"; IMAGE="dokku/$APP"; BUILD_ENV=""
[[ -f "$DOKKU_ROOT/BUILD_ENV" ]] && cat "$DOKKU_ROOT/BUILD_ENV" >> "$DOKKU_ROOT/ENV" && rm "$DOKKU_ROOT/BUILD_ENV"
[[ -f "$DOKKU_ROOT/BUILD_ENV" ]] && cat "$DOKKU_ROOT/BUILD_ENV" >> "$DOKKU_ROOT/ENV" && {
dokku_log_info2 "Using a global BUILD_ENV file is deprecated as of 0.3.26"
rm "$DOKKU_ROOT/BUILD_ENV"
}
! (grep -q CURL_CONNECT_TIMEOUT "$DOKKU_ROOT/ENV" > /dev/null 2>&1) && echo "export CURL_CONNECT_TIMEOUT=5" >> "$DOKKU_ROOT/ENV"
! (grep -q CURL_TIMEOUT "$DOKKU_ROOT/ENV" > /dev/null 2>&1) && echo "export CURL_TIMEOUT=30" >> "$DOKKU_ROOT/ENV"
config_get --global CURL_CONNECT_TIMEOUT > /dev/null 2>&1 || config_set --global CURL_CONNECT_TIMEOUT=5
config_get --global CURL_TIMEOUT > /dev/null 2>&1 || config_set --global CURL_TIMEOUT=30
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
if [[ -n $(config_export global) ]]; then
BUILD_ENV+=$'\n'
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
BUILD_ENV+=$(config_export global)
BUILD_ENV+=$'\n'
fi
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
if [[ -n $(config_export app $APP) ]]; then
BUILD_ENV+=$'\n'
BUILD_ENV+=$(< "$DOKKU_ROOT/$APP/ENV")
BUILD_ENV+=$(config_export app $APP)
BUILD_ENV+=$'\n'
fi

View File

@@ -36,6 +36,7 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
source "$PLUGIN_PATH/config/functions"
APP="$1"; DOKKU_APP_CONTAINER_ID="$2"; DOKKU_APP_CONTAINER_TYPE="$3"; DOKKU_APP_LISTEN_PORT="$4"; DOKKU_APP_LISTEN_IP="$5"
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
@@ -51,8 +52,8 @@ fi
# source global and in-app envs to get DOKKU_CHECKS_WAIT and any other necessary vars
[[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
eval "$(config_export global)"
eval "$(config_export app $APP)"
# Wait this many seconds (default 5) for server to start before running checks.
WAIT="${DOKKU_CHECKS_WAIT:-5}"

View File

@@ -1,200 +1,23 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
config_create () {
[ -f $ENV_FILE ] || {
touch $ENV_FILE
}
}
config_styled_hash () {
vars="$1"
prefix="$2"
longest=""
while read -r word; do
KEY=$(echo $word | cut -d"=" -f1)
if [ ${#KEY} -gt ${#longest} ]; then
longest=$KEY
fi
done <<< "$vars"
while read -r word; do
KEY=$(echo $word | cut -d"=" -f1)
VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//" -e "s/\$$//g")
num_zeros=$((${#longest} - ${#KEY}))
zeros=" "
while [ $num_zeros -gt 0 ]; do
zeros="$zeros "
num_zeros=$((num_zeros - 1))
done
echo "$prefix$KEY:$zeros$VALUE"
done <<< "$vars"
}
config_write() {
ENV_TEMP="$1"
ENV_FILE_TEMP="${ENV_FILE}.tmp"
echo "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP
if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then
cp -f $ENV_FILE_TEMP $ENV_FILE
chmod 600 $ENV_FILE
fi
rm -f $ENV_FILE_TEMP
}
parse_config_args() {
case "$2" in
--global)
ENV_FILE="$DOKKU_ROOT/ENV"
DOKKU_CONFIG_TYPE="global"
DOKKU_CONFIG_RESTART=false
;;
--no-restart)
APP="$3"
ENV_FILE="$DOKKU_ROOT/$APP/ENV"
DOKKU_CONFIG_RESTART=false
DOKKU_CONFIG_TYPE="app"
set -- "${@:1:1}" "${@:3}"
esac
APP=${APP:="$2"}
ENV_FILE=${ENV_FILE:="$DOKKU_ROOT/$APP/ENV"}
DOKKU_CONFIG_TYPE=${DOKKU_CONFIG_TYPE:="app"}
DOKKU_CONFIG_RESTART=${DOKKU_CONFIG_RESTART:=true}
if [[ "$DOKKU_CONFIG_TYPE" = "app" ]]; then
if [[ -z $APP ]]; then
echo "Please specify an app to run the command on" >&2 && exit 1
else
verify_app_name "$2"
fi
fi
export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART
}
source "$PLUGIN_PATH/config/functions"
case "$1" in
config)
parse_config_args "$@"
config_create
[[ "$APP" ]] && DOKKU_CONFIG_TYPE=$APP
[[ ! -s $ENV_FILE ]] && echo "no config vars for $DOKKU_CONFIG_TYPE" && exit 1
VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | cut -d" " -f2-)
for var in "$@"; do
if [[ "$var" == "--shell" ]]; then
echo $VARS
exit 0
fi
done
dokku_log_info2_quiet "$DOKKU_CONFIG_TYPE config vars"
config_styled_hash "$VARS"
config_all "$@"
;;
config:get)
parse_config_args "$@"
if [[ -z $3 ]]; then
echo "Usage: dokku config:get APP KEY"
echo "Must specify KEY."
exit 1
fi
config_create
if [[ ! -s $ENV_FILE ]] ; then
exit 0
fi
KEY="$3"
grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
config_get "$@"
;;
config:set)
parse_config_args "$@"
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
if [[ -z "${*:3}" ]]; then
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
echo "Must specify KEY and VALUE to set."
exit 1
fi
config_create
ENV_ADD=""
ENV_TEMP=$(cat "${ENV_FILE}")
RESTART_APP=false
shift 2
for var; do
if [[ $var != *"="* ]]; then
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
echo "Must specify KEY and VALUE to set."
exit 1
fi
done
for var; do
KEY=$(echo ${var} | cut -d"=" -f1)
VALUE=$(echo ${var} | cut -d"=" -f2-)
if [[ $KEY =~ [a-zA-Z_][a-zA-Z0-9_]* ]]; then
RESTART_APP=true
ENV_TEMP=$(echo "${ENV_TEMP}" | sed "/^export $KEY=/ d")
ENV_TEMP="${ENV_TEMP}
export $KEY='$VALUE'"
ENV_ADD=$(echo -e "${ENV_ADD}" | sed "/^$KEY=/ d")
ENV_ADD="${ENV_ADD}$
${var}"
fi
done
ENV_ADD=$(echo "$ENV_ADD" | tail -n +2) #remove first empty line
if [ $RESTART_APP ]; then
dokku_log_info1 "Setting config vars"
config_styled_hash "$ENV_ADD" " "
config_write "$ENV_TEMP"
fi
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then
dokku_log_info1 "Restarting app $APP"
dokku ps:restart $APP
fi
config_set "$@"
;;
config:unset)
parse_config_args "$@"
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
if [[ -z $3 ]]; then
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
echo "Must specify KEY to unset."
exit 1
fi
config_create
ENV_TEMP=$(cat "${ENV_FILE}")
VARS="${*:3}"
for var in $VARS; do
dokku_log_info1 "Unsetting $var"
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $var=/ d")
config_write "$ENV_TEMP"
done
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then
dokku_log_info1 "Restarting app $APP"
dokku ps:restart $APP
fi
config_unset "$@"
;;
config:set-norestart)

View File

@@ -1,14 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
source "$PLUGIN_PATH/config/functions"
STDIN=$(cat); APP="$1"; IMAGE="dokku/$APP"
DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE"
if ! is_image_herokuish_based "$IMAGE"; then
> "$DOCKERFILE_ENV_FILE"
[[ -f "$DOKKU_ROOT/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/ENV" > "$DOCKERFILE_ENV_FILE"
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/$APP/ENV" >> "$DOCKERFILE_ENV_FILE"
config_export global | sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" > "$DOCKERFILE_ENV_FILE"
config_export app $APP | sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" >> "$DOCKERFILE_ENV_FILE"
echo "$STDIN --env-file=$DOCKERFILE_ENV_FILE"
else

224
plugins/config/functions Normal file
View File

@@ -0,0 +1,224 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
config_export() {
local CONFIG_TYPE="$1"
local APP="$2"
local ENV_FILE="$DOKKU_ROOT/$APP/ENV"
[[ $CONFIG_TYPE == "global" ]] && ENV_FILE="$DOKKU_ROOT/ENV"
[[ ! -f $ENV_FILE ]] && return 0
[[ ! -s $ENV_FILE ]] && return 0
VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | cut -d" " -f2-)
echo "$VARS" | awk '{print "export " $0}'
return 0
}
config_parse_args() {
case "$2" in
--global)
ENV_FILE="$DOKKU_ROOT/ENV"
DOKKU_CONFIG_TYPE="global"
DOKKU_CONFIG_RESTART=false
;;
--no-restart)
APP="$3"
ENV_FILE="$DOKKU_ROOT/$APP/ENV"
DOKKU_CONFIG_RESTART=false
DOKKU_CONFIG_TYPE="app"
set -- "${@:1:1}" "${@:3}"
esac
APP=${APP:="$2"}
ENV_FILE=${ENV_FILE:="$DOKKU_ROOT/$APP/ENV"}
DOKKU_CONFIG_TYPE=${DOKKU_CONFIG_TYPE:="app"}
DOKKU_CONFIG_RESTART=${DOKKU_CONFIG_RESTART:=true}
if [[ "$DOKKU_CONFIG_TYPE" = "app" ]]; then
if [[ -z $APP ]]; then
echo "Please specify an app to run the command on" >&2 && exit 1
else
verify_app_name "$2"
fi
fi
export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART
}
config_create () {
local ENV_FILE=$1
[ -f $ENV_FILE ] || touch $ENV_FILE
}
config_styled_hash () {
local vars="$1"
local prefix="$2"
local longest=""
while read -r word; do
KEY=$(echo $word | cut -d"=" -f1)
if [ ${#KEY} -gt ${#longest} ]; then
longest=$KEY
fi
done <<< "$vars"
while read -r word; do
KEY=$(echo $word | cut -d"=" -f1)
VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//" -e "s/\$$//g")
num_zeros=$((${#longest} - ${#KEY}))
zeros=" "
while [ $num_zeros -gt 0 ]; do
zeros="$zeros "
num_zeros=$((num_zeros - 1))
done
echo "$prefix$KEY:$zeros$VALUE"
done <<< "$vars"
}
config_write() {
local ENV_TEMP="$1"
local ENV_FILE_TEMP="${ENV_FILE}.tmp"
echo "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP
if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then
cp -f $ENV_FILE_TEMP $ENV_FILE
chmod 600 $ENV_FILE
fi
rm -f $ENV_FILE_TEMP
}
is_config_export() {
for var in "$@"; do
if [[ "$var" == "--export" ]]; then
return 0
fi
done
return 1
}
config_all() {
[[ "$1" == "config" ]] || set -- "config" "$@"
config_parse_args "$@"
config_create "$ENV_FILE"
is_config_export "$@" && config_export "$DOKKU_CONFIG_TYPE" "$APP" && exit 0
[[ "$APP" ]] && DOKKU_CONFIG_TYPE=$APP
[[ ! -s $ENV_FILE ]] && echo "no config vars for $DOKKU_CONFIG_TYPE" && exit 1
VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | cut -d" " -f2-)
for var in "$@"; do
if [[ "$var" == "--shell" ]]; then
echo $VARS
exit 0
fi
done
dokku_log_info2_quiet "$DOKKU_CONFIG_TYPE config vars"
config_styled_hash "$VARS"
}
config_get() {
[[ "$1" == "config:get" ]] || set -- "config:get" "$@"
config_parse_args "$@"
if [[ -z $3 ]]; then
echo "Usage: dokku config:get APP KEY"
echo "Must specify KEY."
exit 1
fi
config_create "$ENV_FILE"
if [[ ! -s $ENV_FILE ]] ; then
exit 0
fi
KEY="$3"
grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
}
config_set() {
[[ "$1" == "config:set" ]] || set -- "config:set" "$@"
config_parse_args "$@"
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
if [[ -z "${*:3}" ]]; then
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
echo "Must specify KEY and VALUE to set."
exit 1
fi
config_create "$ENV_FILE"
ENV_ADD=""
ENV_TEMP=$(cat "${ENV_FILE}")
RESTART_APP=false
shift 2
for var; do
if [[ $var != *"="* ]]; then
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
echo "Must specify KEY and VALUE to set."
exit 1
fi
done
for var; do
KEY=$(echo ${var} | cut -d"=" -f1)
VALUE=$(echo ${var} | cut -d"=" -f2-)
if [[ $KEY =~ [a-zA-Z_][a-zA-Z0-9_]* ]]; then
RESTART_APP=true
ENV_TEMP=$(echo "${ENV_TEMP}" | sed "/^export $KEY=/ d")
ENV_TEMP="${ENV_TEMP}
export $KEY='$VALUE'"
ENV_ADD=$(echo -e "${ENV_ADD}" | sed "/^$KEY=/ d")
ENV_ADD="${ENV_ADD}$
${var}"
fi
done
ENV_ADD=$(echo "$ENV_ADD" | tail -n +2) #remove first empty line
if [ $RESTART_APP ]; then
dokku_log_info1 "Setting config vars"
config_styled_hash "$ENV_ADD" " "
config_write "$ENV_TEMP"
fi
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then
dokku_log_info1 "Restarting app $APP"
dokku ps:restart $APP
fi
}
config_unset() {
[[ "$1" == "config:unset" ]] || set -- "config:unset" "$@"
config_parse_args "$@"
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
if [[ -z $3 ]]; then
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
echo "Must specify KEY to unset."
exit 1
fi
config_create "$ENV_FILE"
ENV_TEMP=$(cat "${ENV_FILE}")
VARS="${*:3}"
for var in $VARS; do
dokku_log_info1 "Unsetting $var"
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $var=/ d")
config_write "$ENV_TEMP"
done
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then
dokku_log_info1 "Restarting app $APP"
dokku ps:restart $APP
fi
}

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
source "$PLUGIN_PATH/config/functions"
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
@@ -50,7 +51,7 @@ case "$1" in
fi
if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]];then
dokku_log_info2 "unsupported vhost config found. disabling vhost support"
dokku config:set --no-restart $APP NO_VHOST=1
config_set --no-restart $APP NO_VHOST=1
else
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
dokku_log_info1 "Creating new $VHOST_PATH..."

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/config/functions"
APP="$1"
NO_VHOST=$(dokku config:get $APP NO_VHOST || true)
NO_VHOST=$(config_get $APP NO_VHOST || true)
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
source "$PLUGIN_PATH/config/functions"
validate_nginx () {
set +e
@@ -52,8 +53,8 @@ case "$1" in
DOKKU_APP_CIDS=($(get_app_container_ids $APP))
docker cp "${DOKKU_APP_CIDS[0]}:/app/nginx.conf.template" "$DOKKU_ROOT/$APP/" 2> /dev/null || true
[[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
eval "$(config_export global)"
eval "$(config_export app $APP)"
[[ -f "$APP_NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$APP_NGINX_TEMPLATE" && NGINX_CUSTOM_TEMPLATE="true" && dokku_log_info1 'Overriding default nginx.conf with detected nginx.conf.template'
if [[ ! -n "$NO_VHOST" ]] && [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then

View File

@@ -1,10 +1,11 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
source "$PLUGIN_PATH/config/functions"
APP="$1"
if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then
NO_VHOST=$(dokku config:get $APP NO_VHOST || true)
NO_VHOST=$(config_get $APP NO_VHOST || true)
if [[ -n "$NO_VHOST" ]]; then
dokku_log_info1 "NO_VHOST config detected"