fix broken tar/urls tests

This commit is contained in:
Michael Hobbs
2016-06-15 16:22:45 -07:00
parent ff18e0d6be
commit ab94a9fc67
3 changed files with 13 additions and 14 deletions

View File

@@ -69,6 +69,7 @@ configure_nginx_ports() {
local DOKKU_NGINX_SSL_PORT=$(config_get "$APP" DOKKU_NGINX_SSL_PORT)
local DOKKU_PROXY_PORT_MAP=$(config_get "$APP" DOKKU_PROXY_PORT_MAP)
local IS_APP_VHOST_ENABLED="$(is_app_vhost_enabled "$APP")"
local UPSTREAM_PORT="5000"
if [[ -z "$DOKKU_NGINX_PORT" ]] && [[ -z "$RAW_TCP_PORTS" ]]; then
if [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then
@@ -77,8 +78,8 @@ configure_nginx_ports() {
else
local NGINX_PORT=80
fi
config_set --no-restart "$APP" DOKKU_NGINX_PORT="$NGINX_PORT"
fi
if [[ -z "$DOKKU_NGINX_SSL_PORT" ]]; then
if (is_ssl_enabled "$APP") && [[ -z "$RAW_TCP_PORTS" ]]; then
if [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then
@@ -88,8 +89,8 @@ configure_nginx_ports() {
local NGINX_SSL_PORT=443
fi
fi
config_set --no-restart "$APP" DOKKU_NGINX_SSL_PORT="$NGINX_SSL_PORT"
fi
if [[ -z "$DOKKU_PROXY_PORT_MAP" ]]; then
if [[ -n "$RAW_TCP_PORTS" ]]; then
local RAW_TCP_PORT
@@ -99,14 +100,13 @@ configure_nginx_ports() {
else
local NGINX_PORT=${NGINX_PORT:-$DOKKU_NGINX_PORT}
local NGINX_SSL_PORT=${NGINX_SSL_PORT:-$DOKKU_NGINX_SSL_PORT}
[[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]] && local UPSTREAM_PORT="$(< "$DOKKU_ROOT/$APP/PORT.web.1")"
if [[ -n "$NGINX_PORT" ]] && [[ -n "$NGINX_SSL_PORT" ]]; then
local PROXY_PORT_MAP+=" http:${NGINX_PORT}:5000 https:${NGINX_SSL_PORT}:5000 "
local PROXY_PORT_MAP+=" http:${NGINX_PORT}:$UPSTREAM_PORT https:${NGINX_SSL_PORT}:$UPSTREAM_PORT "
elif [[ -n "$NGINX_PORT" ]]; then
local PROXY_PORT_MAP+=" http:${NGINX_PORT}:5000 "
local PROXY_PORT_MAP+=" http:${NGINX_PORT}:$UPSTREAM_PORT "
fi
fi
if [[ -n "$PROXY_PORT_MAP" ]]; then
local PROXY_PORT_MAP="$(echo "$PROXY_PORT_MAP" | xargs)"
local PROXY_PORT_MAP+=" $(merge_dedupe_list "$(remove_val_from_list "$PORT_MAP" "$DOKKU_PROXY_PORT_MAP" " ")" " ") "

View File

@@ -11,8 +11,7 @@ server {
{{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
access_log /var/log/nginx/{{ $.APP }}-access.log;
error_log /var/log/nginx/{{ $.APP }}-error.log;
{{ if $.SSL_INUSE }}
{{ if eq $listen_port "80" }}
{{ if (and (eq $listen_port "80") ($.SSL_INUSE)) }}
return 301 https://$host:{{ $.NGINX_SSL_PORT }}$request_uri;
{{ else }}
location / {
@@ -35,7 +34,7 @@ server {
proxy_set_header X-Request-Start $msec;
}
include {{ $.DOKKU_ROOT }}/{{ $.APP }}/nginx.conf.d/*.conf;
{{ end }}{{ end }}
{{ end }}
}
{{ else if eq $scheme "https"}}
server {

View File

@@ -57,20 +57,20 @@ build_nginx_config() {
setup_test_tls
assert_urls "https://dokku.me"
build_nginx_config
assert_urls "https://${TEST_APP}.dokku.me"
assert_urls "http://${TEST_APP}.dokku.me" "https://${TEST_APP}.dokku.me"
add_domain "test.dokku.me"
assert_urls "https://test.dokku.me" "https://${TEST_APP}.dokku.me"
assert_urls "http://test.dokku.me" "http://${TEST_APP}.dokku.me" "https://test.dokku.me" "https://${TEST_APP}.dokku.me"
}
@test "(core) urls (wildcard ssl)" {
setup_test_tls wildcard
assert_urls "https://dokku.me"
build_nginx_config
assert_urls "https://${TEST_APP}.dokku.me"
assert_urls "http://${TEST_APP}.dokku.me" "https://${TEST_APP}.dokku.me"
add_domain "test.dokku.me"
assert_urls "https://test.dokku.me" "https://${TEST_APP}.dokku.me"
assert_urls "http://test.dokku.me" "http://${TEST_APP}.dokku.me" "https://test.dokku.me" "https://${TEST_APP}.dokku.me"
add_domain "dokku.example.com"
assert_urls "https://dokku.example.com" "https://test.dokku.me" "https://${TEST_APP}.dokku.me"
assert_urls "http://dokku.example.com" "http://test.dokku.me" "http://${TEST_APP}.dokku.me" "https://dokku.example.com" "https://test.dokku.me" "https://${TEST_APP}.dokku.me"
}
@test "(core) git-remote (off-port)" {