feat: use new authentication style for atlantis dispatch

This commit is contained in:
2024-07-06 16:00:26 +02:00
parent 42f292fb7a
commit 4fa83afe16
2 changed files with 5 additions and 5 deletions

View File

@@ -17,9 +17,9 @@ def send_notification(app, target_user, mapname, old_replay, new_replay):
payload = { "users": [target_user], "msg" : message }
r = requests.post(app.config["DISPATCH_SERVER"] + "/smart-send",
json=payload, auth=app.config["DISPATCH_AUTH"])
url_and_token = "/smart-send?dispatch-access-token={}".format(app.config["DISPATCH_TOKEN"])
r = requests.post(app.config["DISPATCH_SERVER"] + url_and_token, json=payload)
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)

View File

@@ -515,7 +515,7 @@ def create_app():
app.config["DISPATCH_SERVER"] = os.environ.get("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__":