core/server.py

17 lines
571 B
Python
Raw Normal View History

2021-07-13 10:14:48 +00:00
import uvicorn
2022-02-22 11:44:01 +00:00
from settings import PORT, INBOX_SERVICE_PORT
2021-07-13 10:14:48 +00:00
2021-07-26 07:05:08 +00:00
import sys
2021-07-13 10:14:48 +00:00
if __name__ == '__main__':
2021-07-26 07:05:08 +00:00
dev_mode = len(sys.argv) > 1 and sys.argv[1] == "dev"
2022-02-22 11:44:01 +00:00
inbox_service = len(sys.argv) > 1 and sys.argv[1] == "inbox"
2021-10-28 10:42:34 +00:00
if dev_mode:
print("DEV MODE")
2021-07-26 07:05:08 +00:00
uvicorn.run("main:app", host="0.0.0.0", port=8080, ssl_keyfile="discours.key", ssl_certfile="discours.crt", reload=True)
2022-02-22 11:44:01 +00:00
elif inbox_service:
print("INBOX SERVICE")
uvicorn.run("inbox_main:app", host="0.0.0.0", port=INBOX_SERVICE_PORT)
2021-07-26 07:05:08 +00:00
else :
uvicorn.run("main:app", host="0.0.0.0", port=PORT)