aboutsummaryrefslogtreecommitdiff
path: root/webui.py
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2023-05-19 15:52:29 +0300
committerAarni Koskela <akx@iki.fi>2023-05-19 17:35:51 +0300
commit1482c89376037896da1873712bae4b4795cc7b4b (patch)
treec9b5544ced59f366d88f549757a732afb7a16c00 /webui.py
parent4897e5277bcb269aacb3e337b36e78b77fcaa212 (diff)
Refactor validate_tls_options out, fix typo (keyfile was there twice)
Diffstat (limited to 'webui.py')
-rw-r--r--webui.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/webui.py b/webui.py
index 198f4f1a..2110b31b 100644
--- a/webui.py
+++ b/webui.py
@@ -161,9 +161,26 @@ def restore_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():
fix_asyncio_event_loop_policy()
-
+ validate_tls_options()
check_versions()
extensions.list_extensions()
@@ -220,20 +237,6 @@ def initialize():
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
def sigint_handler(sig, frame):
print(f'Interrupted with signal {sig} in {frame}')