Config: Don't load from file if actions present

Loading from file adds extra overhead for actions that don't rely
on file loading.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-09-16 23:29:07 -04:00
parent ececce172e
commit 852ea8faaa

View file

@ -20,11 +20,13 @@ class TabbyConfig(TabbyConfigModel):
"""Synchronously loads the global application config"""
# config is applied in order of items in the list
configs = [
self._from_file(pathlib.Path("config.yml")),
self._from_environment(),
self._from_args(unwrap(arguments, {})),
]
arguments_dict = unwrap(arguments, {})
configs = [self._from_environment(), self._from_args(arguments_dict)]
# If actions aren't present, also look from the file
# TODO: Change logic if file loading requires actions in the future
if not arguments_dict.get("actions"):
configs.insert(0, self._from_file(pathlib.Path("config.yml")))
merged_config = merge_dicts(*configs)