Fix easter egg through CLI (#2542)

This commit is contained in:
Néstor Pérez 2022-09-12 00:44:21 +02:00 committed by GitHub
parent 5fb207176b
commit c8df0aa2cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -192,6 +192,7 @@ Or, a path to a directory to run as a simple HTTP server:
ssl = ssl[0]
kwargs = {
"access_log": self.args.access_log,
"coffee": self.args.coffee,
"debug": self.args.debug,
"fast": self.args.fast,
"host": self.args.host,

View File

@ -262,6 +262,12 @@ class OutputGroup(Group):
name = "Output"
def attach(self):
self.add_bool_arguments(
"--coffee",
dest="coffee",
default=False,
help="Uhm, coffee?",
)
self.add_bool_arguments(
"--motd",
dest="motd",

View File

@ -191,6 +191,7 @@ class RunnerMixin(metaclass=SanicMeta):
fast: bool = False,
verbosity: int = 0,
motd_display: Optional[Dict[str, str]] = None,
coffee: bool = False,
auto_tls: bool = False,
) -> None:
if version == 3 and self.state.server_info:
@ -265,6 +266,9 @@ class RunnerMixin(metaclass=SanicMeta):
except AttributeError: # no cov
workers = os.cpu_count() or 1
if coffee:
self.state.coffee = True
server_settings = self._helper(
host=host,
port=port,