Improve logic to disable telemetry via KHOJ_TELEMETRY_DISABLE env var

The newly added KHOJ_TELEMETRY_DISABLE env var knob to disable
telemetry should override old config mechanism when set
This commit is contained in:
Debanjum
2024-11-24 00:51:26 -08:00
parent 2d683898c2
commit 7c77d65d35

View File

@@ -256,9 +256,9 @@ def get_server_id():
def telemetry_disabled(app_config: AppConfig, telemetry_disable_env) -> bool:
return (
not app_config.should_log_telemetry if app_config and app_config.should_log_telemetry else telemetry_disable_env
)
if telemetry_disable_env is True:
return True
return not app_config or not app_config.should_log_telemetry
def log_telemetry(