[wip] Initial work for setting up proxy on manager

This commit is contained in:
William Wernert
2021-03-02 17:41:49 -05:00
parent 4df53b3c70
commit de77d3ebc9
4 changed files with 89 additions and 2 deletions

View File

@@ -340,6 +340,26 @@ valid_int() {
# {% raw %}
valid_proxy() {
local proxy=$1
local url_prefixes=( 'http://' 'https://' )
local has_prefix=false
for prefix in "${url_prefixes[@]}"; do
echo "$proxy" | grep "$prefix" && has_prefix=true && proxy=${proxy#"$prefix"}
done
local url
readarray -t url -d ':' <<< "$proxy"
local valid_url=true
if ! valid_ip4 "$proxy" && ! valid_fqdn "$proxy"; then
valid_url=false
fi
[[ $has_prefix == true ]] && [[ $valid_url ]] && return 0 || return 1
}
valid_string() {
local str=$1
local min_length=${2:-1}