delete W9_URL_WITH_PORT logic

This commit is contained in:
qiaofeng1227 2025-01-02 08:20:57 +08:00
parent 75e3687a56
commit 600600f3e2
2 changed files with 12 additions and 9 deletions

View File

@ -1,7 +1,7 @@
[nginx_proxy_manager]
base_url = http://websoft9-proxy:81/api
user_name = admin@mydomain.com
user_pwd = 9KCRwcL10saLCGaZ
user_pwd = LMFuCnajkQhK3zeb
nike_name = admin
listen_port = 443
@ -9,18 +9,18 @@ listen_port = 443
base_url = http://websoft9-git:3000/api/v1
user_name = websoft9
user_email = admin@mydomain.com
user_pwd = kk95qed0Fxt8
user_pwd = 93HDu6tUWeGx
[portainer]
base_url = http://websoft9-deployment:9000/api
user_name = admin
user_pwd = FptfbwA1TpUr
user_pwd = 93sX)LLHKJY$
[api_key]
key = cc9223b3055471a6f4f9654e08371816a9637ba1c57383617b0684b92ac7b2f4
[domain]
wildcard_domain =
wildcard_domain = create.websoft9.cn
[cockpit]
port = 9000

View File

@ -429,15 +429,17 @@ class AppManger:
# Verify the app is web app
is_web_app = envHelper.get_value("W9_URL")
url_with_port = envHelper.get_value("W9_URL_WITH_PORT")
# url_with_port = envHelper.get_value("W9_URL_WITH_PORT")
w9_url_with_replace = envHelper.get_value("W9_URL_REPLACE")
if is_web_app is not None:
if url_with_port is None:
if w9_url_with_replace is None:
envHelper.set_value("W9_URL", domain_names[0])
else:
try:
ipaddress.ip_address(domain_names[0])
envHelper.set_value("W9_URL", domain_names[0] + ":" + envHelper.get_value("W9_HTTP_PORT_SET"))
#envHelper.set_value("W9_URL", domain_names[0] + ":" + envHelper.get_value("W9_HTTP_PORT_SET"))
envHelper.set_value("W9_URL", domain_names[0] + ":" + (envHelper.get_value("W9_HTTP_PORT_SET") or envHelper.get_value("W9_HTTPS_PORT_SET")))
except ValueError:
envHelper.set_value("W9_URL", domain_names[0])
@ -1100,7 +1102,7 @@ class AppManger:
# Get the w9_url and w9_url_replace
w9_url_replace = next((element.get("w9_url_replace") for element in app_info.domain_names if element.get("id") == proxy_id), None)
w9_url = next((element.get("w9_url") for element in app_info.domain_names if element.get("id") == proxy_id), None)
# validate w9_url_replace is true
if w9_url_replace:
domain_names = host.get("domain_names",None)
@ -1111,7 +1113,8 @@ class AppManger:
if w9_url in domain_names:
new_w9_url = None
if len(app_proxys) == 1 and app_proxys[0].get("id") == proxy_id:
new_w9_url = client_host
# 如果w9_url_with_port存在并且值为: true
new_w9_url = client_host+":"+ (app_info.env.get("W9_HTTP_PORT_SET") or app_info.env.get("W9_HTTPS_PORT_SET"))
elif len(app_proxys) > 1:
# Get the first proxy_host
proxy_host = next((proxy for proxy in app_proxys if proxy.get("id") != proxy_id), None)