This commit is contained in:
qiaofeng1227 2023-05-16 17:12:17 +08:00
parent 3976b99741
commit e784ed0301
3 changed files with 13 additions and 19 deletions

View file

@ -10,7 +10,7 @@ COPY static ./static
COPY requirements.txt main.py ./
RUN apt update
# Install supervisords
# Install supervisord
RUN apt install -y supervisor
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY config/cmd.sh /cmd.sh

View file

@ -593,10 +593,8 @@ def app_domain_delete(app_id, domain):
'Content-Type': 'application/json'
}
response = requests.delete(url, headers=headers)
myLogger.info_logger(response.json())
myLogger.info_logger(response.json().get("error"))
if response.json().get("error") != None:
raise CommandException(const.ERROR_API_NGINX, response.json()["error"]["message"], "")
if response.json().get("error"):
raise CommandException(const.ERROR_CONFIG_NGINX, response.json().get("error").get("message"), "")
set_domain("", app_id)
else:
proxy_id = proxy["id"]
@ -631,9 +629,8 @@ def app_domain_delete(app_id, domain):
}
response = requests.put(url, data=json.dumps(data), headers=headers)
myLogger.info_logger(response)
#if response.json()["error"] != None:
# raise CommandException(const.ERROR_API_NGINX, response.json()["error"]["message"], "")
if response.json().get("error"):
raise CommandException(const.ERROR_CONFIG_NGINX, response.json().get("error").get("message"), "")
domain_set = app_domain_list(app_id)
default_domain = domain_set['default_domain']
# 如果被删除的域名是默认域名,删除后去剩下域名的第一个
@ -643,7 +640,6 @@ def app_domain_delete(app_id, domain):
else:
raise CommandException(const.ERROR_CLIENT_PARAM_NOTEXIST, "Domain is not bind", "")
def app_domain_update(app_id, domain_old, domain_new):
@ -699,7 +695,8 @@ def app_domain_update(app_id, domain_old, domain_new):
}
response = requests.put(url, data=json.dumps(data), headers=headers)
myLogger.info_logger(response)
if response.json().get("error"):
raise CommandException(const.ERROR_CONFIG_NGINX, response.json().get("error").get("message"), "")
domain_set = app_domain_list(app_id)
default_domain = domain_set['default_domain']
# 如果被修改的域名是默认域名,修改后也设置为默认域名
@ -765,9 +762,8 @@ def app_domain_add(app_id, domain):
"ssl_forced": False
}
response = requests.put(url, data=json.dumps(data), headers=headers)
myLogger.info_logger(response)
#if response.json()["error"] != None:
# raise CommandException(const.ERROR_API_NGINX, response.json()["error"]["message"], "")
if response.json().get("error"):
raise CommandException(const.ERROR_CONFIG_NGINX, response.json().get("error").get("message"), "")
else:
# 追加
token = get_token()
@ -802,11 +798,9 @@ def app_domain_add(app_id, domain):
}
response = requests.post(url, data=json.dumps(data), headers=headers)
myLogger.info_logger(response.json())
myLogger.info_logger(response.json().get("error"))
#if response.json()["error"]:
# myLogger.info_logger(response.json())
# raise CommandException(const.ERROR_API_NGINX, response.json()["error"]["message"], "")
if response.json().get("error"):
raise CommandException(const.ERROR_CONFIG_NGINX, response.json().get("error").get("message"), "")
set_domain(domain, app_id)
return domain

View file

@ -5,7 +5,7 @@ ERROR_CLIENT_PARAM_BLANK="Client.Parameter.Blank.Error"
ERROR_CLIENT_PARAM_Format="Client.Parameter.Format.Error"
ERROR_CLIENT_PARAM_NOTEXIST="Client.Parameter.Value.NotExist.Error"
ERROR_CLIENT_PARAM_REPEAT="Client.Parameter.Value.Repeat.Error"
ERROR_API_NGINX="Api.Nginx.Error"
ERROR_CONFIG_NGINX="Nginx.Configure.Error"
ERROR_SERVER_COMMAND="Server.Container.Error"
ERROR_SERVER_SYSTEM="Server.SystemError"
ERROR_SERVER_RESOURCE="Server.ResourceError"