Refactor validate_tls_options out, fix typo (keyfile was there twice)
This commit is contained in:
parent
4897e5277b
commit
1482c89376
33
webui.py
33
webui.py
@ -161,9 +161,26 @@ def restore_config_state_file():
|
|||||||
print(f"!!! Config state backup not found: {config_state_file}")
|
print(f"!!! Config state backup not found: {config_state_file}")
|
||||||
|
|
||||||
|
|
||||||
|
def validate_tls_options():
|
||||||
|
if not (cmd_opts.tls_keyfile and cmd_opts.tls_certfile):
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
if not os.path.exists(cmd_opts.tls_keyfile):
|
||||||
|
print("Invalid path to TLS keyfile given")
|
||||||
|
if not os.path.exists(cmd_opts.tls_certfile):
|
||||||
|
print(f"Invalid path to TLS certfile: '{cmd_opts.tls_certfile}'")
|
||||||
|
except TypeError:
|
||||||
|
cmd_opts.tls_keyfile = cmd_opts.tls_certfile = None
|
||||||
|
print("TLS setup invalid, running webui without TLS")
|
||||||
|
else:
|
||||||
|
print("Running with TLS")
|
||||||
|
startup_timer.record("TLS")
|
||||||
|
|
||||||
|
|
||||||
def initialize():
|
def initialize():
|
||||||
fix_asyncio_event_loop_policy()
|
fix_asyncio_event_loop_policy()
|
||||||
|
validate_tls_options()
|
||||||
check_versions()
|
check_versions()
|
||||||
|
|
||||||
extensions.list_extensions()
|
extensions.list_extensions()
|
||||||
@ -220,20 +237,6 @@ def initialize():
|
|||||||
|
|
||||||
startup_timer.record("extra networks")
|
startup_timer.record("extra networks")
|
||||||
|
|
||||||
if cmd_opts.tls_keyfile is not None and cmd_opts.tls_keyfile is not None:
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not os.path.exists(cmd_opts.tls_keyfile):
|
|
||||||
print("Invalid path to TLS keyfile given")
|
|
||||||
if not os.path.exists(cmd_opts.tls_certfile):
|
|
||||||
print(f"Invalid path to TLS certfile: '{cmd_opts.tls_certfile}'")
|
|
||||||
except TypeError:
|
|
||||||
cmd_opts.tls_keyfile = cmd_opts.tls_certfile = None
|
|
||||||
print("TLS setup invalid, running webui without TLS")
|
|
||||||
else:
|
|
||||||
print("Running with TLS")
|
|
||||||
startup_timer.record("TLS")
|
|
||||||
|
|
||||||
# make the program just exit at ctrl+c without waiting for anything
|
# make the program just exit at ctrl+c without waiting for anything
|
||||||
def sigint_handler(sig, frame):
|
def sigint_handler(sig, frame):
|
||||||
print(f'Interrupted with signal {sig} in {frame}')
|
print(f'Interrupted with signal {sig} in {frame}')
|
||||||
|
Loading…
Reference in New Issue
Block a user