1- __version__ = "1.1"
1+ __version__ = "1.1.1 "
22
33import os
44
55from motor .motor_asyncio import AsyncIOMotorClient
66from sanic import Sanic , response
7- from sanic .exceptions import abort , NotFound
7+ from sanic .exceptions import NotFound
88from jinja2 import Environment , FileSystemLoader
99
1010from core .models import LogEntry
1919if prefix == "NONE" :
2020 prefix = ""
2121
22- app = Sanic (__name__ )
22+ MONGO_URI = os .getenv ("MONGO_URI" )
23+ if not MONGO_URI :
24+ MONGO_URI = os .environ ['CONNECTION_URI' ]
2325
26+ app = Sanic (__name__ )
2427app .static ("/static" , "./static" )
2528
2629jinja_env = Environment (loader = FileSystemLoader ("templates" ))
@@ -36,7 +39,7 @@ def render_template(name, *args, **kwargs):
3639
3740@app .listener ("before_server_start" )
3841async def init (app , loop ):
39- app .ctx .db = AsyncIOMotorClient (os . getenv ( " MONGO_URI" ) ).modmail_bot
42+ app .ctx .db = AsyncIOMotorClient (MONGO_URI ).modmail_bot
4043
4144
4245@app .exception (NotFound )
@@ -55,7 +58,7 @@ async def get_raw_logs_file(request, key):
5558 document = await app .ctx .db .logs .find_one ({"key" : key })
5659
5760 if document is None :
58- abort ( 404 )
61+ raise NotFound
5962
6063 log_entry = LogEntry (app , document )
6164
@@ -68,7 +71,7 @@ async def get_logs_file(request, key):
6871 document = await app .ctx .db .logs .find_one ({"key" : key })
6972
7073 if document is None :
71- abort ( 404 )
74+ raise NotFound
7275
7376 log_entry = LogEntry (app , document )
7477
0 commit comments