Update manage.py

This commit is contained in:
qiaofeng1227 2023-05-13 11:21:42 +08:00 committed by GitHub
parent 16c263ef35
commit 67c33145e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -603,9 +603,13 @@ def app_domain_delete(app_id, domains):
#set_domain("", app_id) #set_domain("", app_id)
def app_domain_update(app_id, domains): def app_domain_update(app_id, domain_old, domain_new):
check_domains(domains) domain_list = []
domain_list.append(domain_old)
domain_list.append(domain_new)
check_domains(domain_list)
code, message = docker.check_app_id(app_id) code, message = docker.check_app_id(app_id)
if code == None: if code == None:
@ -618,6 +622,9 @@ def app_domain_update(app_id, domains):
raise CommandException(code, message, "") raise CommandException(code, message, "")
proxy = get_proxy(app_id) proxy = get_proxy(app_id)
if proxy != None: if proxy != None:
domains_old = proxy["domains"]
index = domains_old.index(domain_old)
domains_old[index] = domain_new
proxy_id = proxy["id"] proxy_id = proxy["id"]
token = get_token() token = get_token()
url = "http:/172.17.0.1:9092/api/nginx/proxy-hosts/" + str(proxy_id) url = "http:/172.17.0.1:9092/api/nginx/proxy-hosts/" + str(proxy_id)
@ -628,7 +635,7 @@ def app_domain_update(app_id, domains):
port = get_container_port(app_id.split('_')[1]) port = get_container_port(app_id.split('_')[1])
host = app_id.split('_')[1] host = app_id.split('_')[1]
data = { data = {
"domain_names": domains, "domain_names": domains_old,
"forward_scheme": "http", "forward_scheme": "http",
"forward_host": host, "forward_host": host,
"forward_port": port, "forward_port": port,