Update manage.py

This commit is contained in:
qiaofeng1227 2023-05-16 11:02:57 +08:00 committed by GitHub
parent d6d4adc1d2
commit 6291f4ab63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -915,7 +915,7 @@ def set_domain(domain, app_id):
old_domains = get_all_domains(app_id)
if domain != "":
if domain not in old_domains:
raise CommandException(const.ERROR_CLIENT_PARAM_NOTEXIST, "Domain is not binded", "")
raise CommandException(const.ERROR_CLIENT_PARAM_NOTEXIST, "Binded Domains has no this domain", "")
customer_name = app_id.split('_')[1]
app_url = shell_execute.execute_command_output_all("cat /data/apps/" + customer_name +"/.env")["result"]
@ -927,10 +927,12 @@ def set_domain(domain, app_id):
domain = ip_result["result"].rstrip('\n')
cmd = "sed -i 's/APP_URL=.*/APP_URL=" + domain + "/g' /data/apps/" + customer_name +"/.env"
shell_execute.execute_command_output_all(cmd)
if "APP_URL_REPLACE=true" in app_url:
shell_execute.execute_command_output_all("cd /data/apps/" + customer_name + " && docker compose up -d")
else:
cmd = "sed -i 's/APP_URL=.*/APP_URL=" + domain + "/g' /data/apps/" + customer_name +"/.env"
shell_execute.execute_command_output_all(cmd)
if "APP_URL_REPLACE=true" in app_url:
shell_execute.execute_command_output_all("cd /data/apps/" + customer_name + " && docker compose up -d")
myLogger.info_logger("set_domain success")