diff options
author | John Estabrook <jestabro@vyos.io> | 2020-05-06 17:49:12 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2020-05-06 19:12:32 -0500 |
commit | 7b31dd720d96bc481323e3b00100da718f551cd5 (patch) | |
tree | a4c0376134aaeb6afc213b5dfc963eae9a07730b | |
parent | c4312498ebe0643061f1d06ad9655d49fb9d9af7 (diff) | |
download | vyos-1x-7b31dd720d96bc481323e3b00100da718f551cd5.tar.gz vyos-1x-7b31dd720d96bc481323e3b00100da718f551cd5.zip |
http api: T2395: add waitress as production WSGI server
-rw-r--r-- | debian/control | 1 | ||||
-rwxr-xr-x | src/services/vyos-http-api-server | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/debian/control b/debian/control index 592d5153d..32c0286a4 100644 --- a/debian/control +++ b/debian/control @@ -29,6 +29,7 @@ Depends: python3, python3-hurry.filesize, python3-vici (>= 5.7.2), python3-flask, + python3-waitress, python3-netaddr, python3-zmq, cron, diff --git a/src/services/vyos-http-api-server b/src/services/vyos-http-api-server index 4a653bb66..4c41fa96d 100755 --- a/src/services/vyos-http-api-server +++ b/src/services/vyos-http-api-server @@ -27,6 +27,7 @@ import signal import vyos.config from flask import Flask, request +from waitress import serve from functools import wraps @@ -395,4 +396,8 @@ if __name__ == '__main__': signal.signal(signal.SIGTERM, sig_handler) - app.run(host=server_config["listen_address"], port=server_config["port"], debug=True) + try: + serve(app, host=server_config["listen_address"], + port=server_config["port"]) + except OSError as e: + print(f"OSError {e}") |