From 07e3581efdb0a3d53ad5c91f673f8fba5b0eec13 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Sep 15 2020 09:02:48 +0000 Subject: add cert and key options --- diff --git a/requirements.txt b/requirements.txt index af5bd9a..1f0e49d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ wtforms arrow blinker # required by Flask for the unit-tests (for signaling) six +fasjson_client diff --git a/runserver.py b/runserver.py index 9b516c1..54cbbea 100644 --- a/runserver.py +++ b/runserver.py @@ -26,6 +26,12 @@ parser.add_argument( '--port', '-p', default=5005, help='Port for the flask application.') parser.add_argument( + '--cert', '-s', default=None, + help='Filename of SSL cert for the flask application.') +parser.add_argument( + '--key', '-k', default=None, + help='Filename of the SSL key for the flask application.') +parser.add_argument( '--host', default="127.0.0.1", help='Hostname to listen on. When set to 0.0.0.0 the server is available \ externally. Defaults to 127.0.0.1 making the it only visable on localhost') @@ -47,4 +53,7 @@ if args.config: os.environ['FEDORA_ELECTIONS_CONFIG'] = config APP.debug = True -APP.run(host=args.host, port=int(args.port)) +if args.cert and args.key: + APP.run(host=args.host, port=int(args.port), ssl_context=(args.cert, args.key)) +else: + APP.run(host=args.host, port=int(args.port))