From d11ec7e9efb10aa2f075debc0574579e2fb46b54 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jul 31 2023 02:38:20 +0000 Subject: Add cert and key args to runserver.py Signed-off-by: Ryan Lerch --- diff --git a/runserver.py b/runserver.py index b1679d4..9dab408 100755 --- a/runserver.py +++ b/runserver.py @@ -61,6 +61,16 @@ parser.add_argument( "externally. Defaults to 127.0.0.1 making the it only visible on localhost", ) +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.", +) + args = parser.parse_args() if args.config: @@ -97,4 +107,8 @@ if args.profile: APP.wsgi_app = ProfilerMiddleware(APP.wsgi_app, restrictions=[30]) APP.debug = not args.no_debug -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))