Browse Source

Add cert and key args to runserver.py

Signed-off-by: Ryan Lerch <rlerch@redhat.com>
Ryan Lerch 9 months ago
parent
commit
d11ec7e9ef
1 changed files with 15 additions and 1 deletions
  1. 15 1
      runserver.py

+ 15 - 1
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))