mirror of
https://github.com/QingdaoU/JudgeServer.git
synced 2025-01-16 17:49:59 +00:00
simpily server url
This commit is contained in:
parent
0be7e76a53
commit
4b04ba4ef4
@ -11,20 +11,11 @@ from utils import server_info, logger, token
|
||||
|
||||
class JudgeService(object):
|
||||
def __init__(self):
|
||||
# this container's ip and port, if these are not set, web server will think it's a linked container
|
||||
self.service_url = os.environ.get("service_url")
|
||||
self.service_discovery_url = os.environ.get("service_discovery_url")
|
||||
|
||||
# exists if docker link oj_web_server:oj_web_server
|
||||
self.service_discovery_host = os.environ.get("OJ_WEB_SERVER_PORT_8080_TCP_ADDR")
|
||||
self.service_discovery_port = os.environ.get("OJ_WEB_SERVER_PORT_8080_TCP_PORT")
|
||||
self.service_discovery_url = os.environ.get("service_discovery_url", "")
|
||||
|
||||
if not self.service_discovery_url:
|
||||
if not (self.service_discovery_host and self.service_discovery_port):
|
||||
raise JudgeServiceError("service discovery host or port not found")
|
||||
else:
|
||||
self.service_discovery_url = "http://" + self.service_discovery_host + ":" + \
|
||||
str(self.service_discovery_port) + "/api/judge_server_heartbeat/"
|
||||
if not self.service_url or not self.service_discovery_url:
|
||||
raise JudgeServiceError("service url or service discovery url not set")
|
||||
|
||||
def _request(self, data):
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user