mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Merge pull request #6801 from dokku/6764-invalid-proxy
Guard against invalid proxy values due to move of port mapping to ports plugin
This commit is contained in:
@@ -2,6 +2,7 @@ package proxy
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
"github.com/dokku/dokku/plugins/config"
|
||||
@@ -89,6 +90,11 @@ func CommandSet(appName string, proxyType string) error {
|
||||
return errors.New("Please specify a proxy type")
|
||||
}
|
||||
|
||||
if strings.Contains(proxyType, ":") {
|
||||
common.LogWarn("Detected potential port mapping instead of proxy type")
|
||||
return errors.New("Consider using ports:set command or specifying a valid proxy")
|
||||
}
|
||||
|
||||
key := "DOKKU_APP_PROXY_TYPE"
|
||||
if appName == "--global" {
|
||||
key = "DOKKU_PROXY_TYPE"
|
||||
|
||||
@@ -28,6 +28,14 @@ teardown() {
|
||||
assert_output "$help_output"
|
||||
}
|
||||
|
||||
@test "(proxy:set) invalid port mapping set" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP http:80:80"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Detected potential port mapping instead of proxy type"
|
||||
}
|
||||
|
||||
@test "(proxy) proxy:build-config/clear-config" {
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
|
||||
Reference in New Issue
Block a user