From 9d31988f42c8e6dc75d99256761b7c3bf96adbb0 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Tue, 3 Jan 2023 21:36:59 -0300 Subject: [PATCH] Allow starting khoj in non-GUI mode without config file instantiated - Start khoj server (in non-GUI mode) without needing config file already instantiated. - But throw warning to configure khoj to use it - This allows plugins to configure the app via the /config/data APIs - To be used by the Khoj obsidian plugin to configure markdown content in khoj --- src/configure.py | 3 ++- src/main.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/configure.py b/src/configure.py index 45e1661e..1ddc9f76 100644 --- a/src/configure.py +++ b/src/configure.py @@ -26,9 +26,10 @@ logger = logging.getLogger(__name__) def configure_server(args, required=False): if args.config is None: if required: - print('Exiting as Khoj is not configured. Configure the application to use it.') + logger.error(f'Exiting as Khoj is not configured.\nConfigure it via GUI or by editing {state.config_file}.') sys.exit(1) else: + logger.warn(f'Khoj is not configured.\nConfigure it via khoj GUI, plugins or by editing {state.config_file}.') return else: state.config = args.config diff --git a/src/main.py b/src/main.py index 20ef8121..0c5937f3 100644 --- a/src/main.py +++ b/src/main.py @@ -77,7 +77,7 @@ def run(): # Setup task scheduler poll_task_scheduler() # Start Server - configure_server(args, required=True) + configure_server(args, required=False) start_server(app, host=args.host, port=args.port, socket=args.socket) else: # Setup GUI