mirror of
https://github.com/FAUSheppy/tmnf-replay-server.git
synced 2025-12-06 07:01:37 +01:00
feat: use new authentication style for atlantis dispatch
This commit is contained in:
@@ -17,9 +17,9 @@ def send_notification(app, target_user, mapname, old_replay, new_replay):
|
|||||||
|
|
||||||
payload = { "users": [target_user], "msg" : message }
|
payload = { "users": [target_user], "msg" : message }
|
||||||
|
|
||||||
|
url_and_token = "/smart-send?dispatch-access-token={}".format(app.config["DISPATCH_TOKEN"])
|
||||||
r = requests.post(app.config["DISPATCH_SERVER"] + "/smart-send",
|
r = requests.post(app.config["DISPATCH_SERVER"] + url_and_token, json=payload)
|
||||||
json=payload, auth=app.config["DISPATCH_AUTH"])
|
|
||||||
|
|
||||||
if not r.ok:
|
if not r.ok:
|
||||||
print("Error handing off notification to dispatch ({})".format(r.status_code), file=sys.stderr)
|
msg = "Error handing off notification to dispatch ({} {})".format(r.status_code, r.content)
|
||||||
|
print(msg, file=sys.stderr)
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ def create_app():
|
|||||||
|
|
||||||
app.config["DISPATCH_SERVER"] = os.environ.get("DISPATCH_SERVER")
|
app.config["DISPATCH_SERVER"] = os.environ.get("DISPATCH_SERVER")
|
||||||
if app.config["DISPATCH_SERVER"]:
|
if app.config["DISPATCH_SERVER"]:
|
||||||
app.config["DISPATCH_AUTH"] = (os.environ["DISPATCH_AUTH_USER"], os.environ["DISPATCH_AUTH_PASSWORD"])
|
app.config["DISPATCH_TOKEN"] = os.environ["DISPATCH_TOKEN"]
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user