From 80b7d968ff3f46dc6ecfca949ad4a4434af5527c Mon Sep 17 00:00:00 2001 From: Sterling Dreyer Date: Wed, 23 Oct 2024 15:31:37 -0700 Subject: [PATCH] Search for etc paths (#118) Depends on: https://github.com/ArcadeAI/arcade-ai/pull/116 --- arcade/arcade/cli/launcher.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arcade/arcade/cli/launcher.py b/arcade/arcade/cli/launcher.py index 521e628e..d5325332 100644 --- a/arcade/arcade/cli/launcher.py +++ b/arcade/arcade/cli/launcher.py @@ -16,6 +16,16 @@ from rich.console import Console console = Console(highlight=False) logger = logging.getLogger(__name__) +known_engine_config_locations = [ + "/etc/arcade-ai", + "/etc/arcade-engine", + "/opt/homebrew/etc/arcade-engine", +] + +if os.environ.get("HOMEBREW_REPOSITORY") is not None: + homebrew_home = os.path.join(os.environ["HOMEBREW_REPOSITORY"], "etc", "arcade-engine") + known_engine_config_locations.append(homebrew_home) + def start_servers( host: str, @@ -130,6 +140,13 @@ def _get_config_file(file_path: str | None, default_filename: str = "engine.yaml console.print(f"Using config file at {home_config_path}", style="bold green") return str(home_config_path) + # Look for known installation directories + for path in known_engine_config_locations: + etc_path = Path(path) / default_filename + if etc_path.is_file(): + console.print(f"Using config file at {etc_path}", style="bold green") + return str(etc_path) + console.print( f"❌ Config file '{default_filename}' not found in any of the default locations.", style="bold red",