[mod] added upstream port customization

This commit is contained in:
2021-02-02 21:58:50 -05:00
parent aef30adb1f
commit 558b980c1e
2 changed files with 8 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
# domains are seperated with \n
DOMAINS=example.com www api test
# server values are seperated with ' ' (space) (one server per domain)
SERVER=web
# port can be appended, default is 8080 if ommited
SERVER=web:8080

View File

@@ -138,6 +138,10 @@ function gen_server_config()
local domain_count=0
local domains="$root_domain"
# default to 8080 if server port is undefined
local port=":8080";
[[ $server == *":"* ]] && port=""
# no arrays in dash
local subdomain=$(get_element $domain_count " " $domain_list)
while [ ${#subdomain} -gt 0 ]; do
@@ -167,7 +171,7 @@ function gen_server_config()
# allow for upstream to be offline by setting
# docker dns resolver and a variable for the server
resolver 127.0.0.11 valid=30s;
proxy_pass http://\$upstream:8080;
proxy_pass http://\$upstream$port;
proxy_redirect off;
proxy_set_header Host \$host;
@@ -299,4 +303,4 @@ function main()
nginx_handler
}
main $@
main $@