From ad692e59388e41b29e060124324210e5b3af9a4c Mon Sep 17 00:00:00 2001 From: Lili Date: Mon, 22 Aug 2022 16:58:10 +0200 Subject: [PATCH] add owncast instance url to config --- tlapbot/default_config.py | 3 ++- tlapbot/owncastWebhooks.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tlapbot/default_config.py b/tlapbot/default_config.py index 2cb5bc2..1afe300 100644 --- a/tlapbot/default_config.py +++ b/tlapbot/default_config.py @@ -1,3 +1,4 @@ SECRET_KEY='dev' DATABASE='./instance/tlapbot.sqlite' -OWNCAST_ACCESS_TOKEN='' \ No newline at end of file +OWNCAST_ACCESS_TOKEN='' +OWNCAST_INSTANCE_URL='http://localhost:8080' \ No newline at end of file diff --git a/tlapbot/owncastWebhooks.py b/tlapbot/owncastWebhooks.py index 776d46a..0029fcd 100644 --- a/tlapbot/owncastWebhooks.py +++ b/tlapbot/owncastWebhooks.py @@ -36,7 +36,7 @@ def addUserToDatabase(user_id, db): print("To user:", user_id) def sendChat(message): # TODO: url to constant? - url = 'http://localhost:8080/api/integrations/chat/send' + url = current_app.config['OWNCAST_INSTANCE_URL'] + '/api/integrations/chat/send' headers = {"Authorization": "Bearer " + current_app.config['OWNCAST_ACCESS_TOKEN']} r = requests.post(url, headers=headers, json={"body": message}) return r.json()