support overriding listening IP during dev

This commit is contained in:
Damien Elmes 2021-04-15 21:15:29 +10:00
parent db716b92f9
commit 6632b63a11

View File

@ -64,10 +64,11 @@ class MediaServer(threading.Thread):
logging.basicConfig() logging.basicConfig()
logging.getLogger("waitress").setLevel(logging.ERROR) logging.getLogger("waitress").setLevel(logging.ERROR)
desired_host = os.getenv("ANKI_API_HOST", "127.0.0.1")
desired_port = int(os.getenv("ANKI_API_PORT", "0")) desired_port = int(os.getenv("ANKI_API_PORT", "0"))
self.server = create_server( self.server = create_server(
app, app,
host="127.0.0.1", host=desired_host,
port=desired_port, port=desired_port,
clear_untrusted_proxy_headers=True, clear_untrusted_proxy_headers=True,
) )