diff --git a/server/service.py b/server/service.py index 7bb90d2..208941b 100644 --- a/server/service.py +++ b/server/service.py @@ -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: