[misc] Fix production issues

This commit is contained in:
Cathy Hu 2020-09-10 19:29:57 +02:00
parent d5ebd481b4
commit 28396eb379
2 changed files with 3 additions and 1 deletions

View file

@ -57,6 +57,8 @@ class Main:
app = FastAPI() app = FastAPI()
server_config = Config() server_config = Config()
server_config.accesslog = '-' server_config.accesslog = '-'
if config['production']:
server_config.bind = ['0.0.0.0:8000', '[::]:8000']
app.include_router(router, prefix='/api') app.include_router(router, prefix='/api')
if not config['production'] and config['cors_allow_origin']: if not config['production'] and config['cors_allow_origin']:
app.add_middleware( app.add_middleware(

View file

@ -55,7 +55,7 @@ async def telegram_read_all_public(hood=Depends(get_hood_unauthorized)):
return [ return [
BodyTelegramPublic(username=telegrambot.username) BodyTelegramPublic(username=telegrambot.username)
for telegrambot in telegrambots for telegrambot in telegrambots
if telegrambot.enabled == 1 if telegrambot.enabled == 1 and telegrambot.username
] ]