mirror of
https://github.com/QingdaoU/JudgeServer.git
synced 2024-12-28 21:31:43 +00:00
use new url name
This commit is contained in:
parent
003be998cd
commit
3c4f5b3933
@ -19,8 +19,8 @@ services:
|
||||
- /data/log:/log
|
||||
- $PWD/server:/code:ro
|
||||
environment:
|
||||
- service_discovery_url=http://127.0.0.1:8000/api/judge_server_heartbeat
|
||||
- service_url=http://127.0.0.1:12358
|
||||
- backend_url=http://backend:8000/api/judge_server_heartbeat
|
||||
- service_url=http://judge-server:12358
|
||||
- TOKEN=YOUR_TOKEN_HERE
|
||||
ports:
|
||||
- "0.0.0.0:12358:8080"
|
||||
|
@ -11,17 +11,13 @@ from utils import server_info, logger, token
|
||||
|
||||
class JudgeService(object):
|
||||
def __init__(self):
|
||||
self.service_url = os.environ.get("service_url")
|
||||
self.service_discovery_url = os.environ.get("service_discovery_url")
|
||||
|
||||
if not self.service_url or not self.service_discovery_url:
|
||||
raise JudgeServiceError("service url or service discovery url not set")
|
||||
self.service_url = os.environ["service_url"]
|
||||
self.backend_url = os.environ["backend_url"]
|
||||
|
||||
def _request(self, data):
|
||||
try:
|
||||
r = requests.post(self.service_discovery_url, data=json.dumps(data),
|
||||
headers={"X-JUDGE-SERVER-TOKEN": token,
|
||||
"Content-Type": "application/json"}, timeout=5).json()
|
||||
r = requests.post(self.backend_url, json=data,
|
||||
headers={"X-JUDGE-SERVER-TOKEN": token}, timeout=5).json()
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
raise JudgeServiceError(e.message)
|
||||
|
Loading…
Reference in New Issue
Block a user