Search for etc paths (#118)
Depends on: https://github.com/ArcadeAI/arcade-ai/pull/116
This commit is contained in:
parent
9d00295e33
commit
80b7d968ff
1 changed files with 17 additions and 0 deletions
|
|
@ -16,6 +16,16 @@ from rich.console import Console
|
||||||
console = Console(highlight=False)
|
console = Console(highlight=False)
|
||||||
logger = logging.getLogger(__name__)
|
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(
|
def start_servers(
|
||||||
host: str,
|
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")
|
console.print(f"Using config file at {home_config_path}", style="bold green")
|
||||||
return str(home_config_path)
|
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(
|
console.print(
|
||||||
f"❌ Config file '{default_filename}' not found in any of the default locations.",
|
f"❌ Config file '{default_filename}' not found in any of the default locations.",
|
||||||
style="bold red",
|
style="bold red",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue