From 02fcb1df1b53e6355bf077e5b2cae7ea43903ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 11 Aug 2024 22:23:12 +0200 Subject: [PATCH] get_apps_repo: add YNH_APPS_DIR env var to set --apps-dir --- tools/appslib/get_apps_repo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/appslib/get_apps_repo.py b/tools/appslib/get_apps_repo.py index 21675657e0..c8094a161e 100644 --- a/tools/appslib/get_apps_repo.py +++ b/tools/appslib/get_apps_repo.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import os import argparse import tempfile import logging @@ -19,10 +20,13 @@ def __init__(self, *args, **kwargs): def add_args(parser: argparse.ArgumentParser, required: bool = False) -> None: + env_apps_dir_str = os.environ.get("YNH_APPS_DIR") + env_apps_dir = Path(env_apps_dir_str) if env_apps_dir_str is not None else None + repo_group = parser.add_mutually_exclusive_group(required=required) repo_group.add_argument("-c", "--apps-repo", type=str, default=DEFAULT_GIT_REPO, help="Git url to clone the 'apps' repository") - repo_group.add_argument("-d", "--apps-dir", type=Path, help="Path to an existing 'apps' repository") + repo_group.add_argument("-d", "--apps-dir", type=Path, help="Path to an existing 'apps' repository", default=env_apps_dir) def from_args(args: argparse.Namespace) -> Path: