Move configuration from config.py to config.json and add support for GitHub organization webhooks

remove _format_watch() from utils.github_webhook as the value of
watchers_count is always identical with stargazers_count
https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#watch
https://developer.github.com/changes/2012-09-05-watcher-api/
This commit is contained in:
Dash Eclipse
2021-04-21 23:57:51 +00:00
parent 08c985a805
commit d3dc14977b
8 changed files with 76 additions and 49 deletions
+12
View File
@@ -0,0 +1,12 @@
import json
from os import environ
if environ.get('DYNO'):
data = json.loads(environ.get("HOOK_CONFIG"))
else:
with open("config.json") as f:
data = json.load(f)
BOT_TOKEN = data['bot_token']
PORT = data.get('port')
GH_WEBHOOKS = data['gh_webhooks']