Skip to content

Commit adca68c

Browse files
authored
Fix serve commands SSL options (#523)
1 parent fcbb50f commit adca68c

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

emmett/cli.py

+25-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import code
1717
import os
18+
import pathlib
1819
import re
1920
import sys
2021
import types
@@ -232,8 +233,18 @@ def main(self, *args, **kwargs):
232233
@click.option(
233234
"--loop", type=click.Choice(["auto", "asyncio", "uvloop"]), default="auto", help="Event loop implementation."
234235
)
235-
@click.option("--ssl-certfile", type=str, default=None, help="SSL certificate file")
236-
@click.option("--ssl-keyfile", type=str, default=None, help="SSL key file")
236+
@click.option(
237+
"--ssl-certfile",
238+
type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True, path_type=pathlib.Path),
239+
default=None,
240+
help="SSL certificate file",
241+
)
242+
@click.option(
243+
"--ssl-keyfile",
244+
type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True, path_type=pathlib.Path),
245+
default=None,
246+
help="SSL key file",
247+
)
237248
@click.option("--reloader/--no-reloader", is_flag=True, default=True, help="Runs with reloader.")
238249
@pass_script_info
239250
def develop_command(info, host, port, interface, loop, ssl_certfile, ssl_keyfile, reloader):
@@ -296,8 +307,18 @@ def develop_command(info, host, port, interface, loop, ssl_certfile, ssl_keyfile
296307
@click.option("--access-log/--no-access-log", is_flag=True, default=False, help="Enable access log.")
297308
@click.option("--backlog", type=int, default=2048, help="Maximum number of connections to hold in backlog")
298309
@click.option("--backpressure", type=int, help="Maximum number of requests to process concurrently (per worker)")
299-
@click.option("--ssl-certfile", type=str, default=None, help="SSL certificate file")
300-
@click.option("--ssl-keyfile", type=str, default=None, help="SSL key file")
310+
@click.option(
311+
"--ssl-certfile",
312+
type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True, path_type=pathlib.Path),
313+
default=None,
314+
help="SSL certificate file",
315+
)
316+
@click.option(
317+
"--ssl-keyfile",
318+
type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True, path_type=pathlib.Path),
319+
default=None,
320+
help="SSL key file",
321+
)
301322
@pass_script_info
302323
def serve_command(
303324
info,

0 commit comments

Comments
 (0)