[mod] load secret on startup to avoid runtime error

This commit is contained in:
Laurent Peuch 2019-02-06 00:55:19 +01:00
parent acf2c52d7f
commit e56e285e54

View file

@ -8,6 +8,8 @@ from sanic.exceptions import abort
app = Sanic() app = Sanic()
secret = open("./github_webhook_secret", "r").read().strip()
other_chans = { other_chans = {
"doc": "doc", "doc": "doc",
} }
@ -25,8 +27,6 @@ def notify(message, chan="dev"):
@app.route("/github", methods=['POST']) @app.route("/github", methods=['POST'])
async def github(request): async def github(request):
secret = open("./github_webhook_secret", "r").read().strip()
# Only SHA1 is supported # Only SHA1 is supported
header_signature = request.headers.get('X-Hub-Signature') header_signature = request.headers.get('X-Hub-Signature')
if header_signature is None: if header_signature is None: