mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-30 19:03:01 +01:00
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
This commit is contained in:
parent
52664dd96c
commit
9d31988f42
2 changed files with 3 additions and 2 deletions
|
@ -26,9 +26,10 @@ logger = logging.getLogger(__name__)
|
||||||
def configure_server(args, required=False):
|
def configure_server(args, required=False):
|
||||||
if args.config is None:
|
if args.config is None:
|
||||||
if required:
|
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)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
|
logger.warn(f'Khoj is not configured.\nConfigure it via khoj GUI, plugins or by editing {state.config_file}.')
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
state.config = args.config
|
state.config = args.config
|
||||||
|
|
|
@ -77,7 +77,7 @@ def run():
|
||||||
# Setup task scheduler
|
# Setup task scheduler
|
||||||
poll_task_scheduler()
|
poll_task_scheduler()
|
||||||
# Start Server
|
# Start Server
|
||||||
configure_server(args, required=True)
|
configure_server(args, required=False)
|
||||||
start_server(app, host=args.host, port=args.port, socket=args.socket)
|
start_server(app, host=args.host, port=args.port, socket=args.socket)
|
||||||
else:
|
else:
|
||||||
# Setup GUI
|
# Setup GUI
|
||||||
|
|
Loading…
Reference in a new issue