This is an automated email from the ASF dual-hosted git repository.

yufei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 90c981af0 CLI: Remove SCRIPT_DIR and default config location to user 
home (#2448)
90c981af0 is described below

commit 90c981af0f2af586cf4323d046179f3a4916531d
Author: Yong Zheng <yongzheng0...@gmail.com>
AuthorDate: Thu Sep 4 11:57:50 2025 -0500

    CLI: Remove SCRIPT_DIR and default config location to user home (#2448)
---
 Makefile                                                 | 2 +-
 client/python/cli/command/profiles.py                    | 1 +
 client/python/cli/constants.py                           | 6 +-----
 polaris                                                  | 1 -
 site/content/in-dev/unreleased/command-line-interface.md | 2 +-
 5 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index a68f542f9..aa88f5248 100644
--- a/Makefile
+++ b/Makefile
@@ -140,7 +140,7 @@ client-regenerate: client-setup-env ## Regenerate the 
client code
 .PHONY: client-unit-test
 client-unit-test: client-setup-env ## Run client unit tests
        @echo "--- Running client unit tests ---"
-       @$(ACTIVATE_AND_CD) && SCRIPT_DIR="non-existing-mock-directory" poetry 
run pytest test/
+       @$(ACTIVATE_AND_CD) && poetry run pytest test/
        @echo "--- Client unit tests complete ---"
 
 .PHONY: client-integration-test
diff --git a/client/python/cli/command/profiles.py 
b/client/python/cli/command/profiles.py
index fc689ae2b..8a44e9e05 100644
--- a/client/python/cli/command/profiles.py
+++ b/client/python/cli/command/profiles.py
@@ -56,6 +56,7 @@ class ProfilesCommand(Command):
         if not os.path.exists(CONFIG_FILE):
             return {}
         with open(CONFIG_FILE, "r") as f:
+            print(f"Loading profiles from {CONFIG_FILE}")
             return json.load(f)
 
     def _save_profiles(self, profiles: Dict[str, Dict[str, str]]) -> None:
diff --git a/client/python/cli/constants.py b/client/python/cli/constants.py
index 1a6ec4c42..82a4f5d01 100644
--- a/client/python/cli/constants.py
+++ b/client/python/cli/constants.py
@@ -371,9 +371,5 @@ CLIENT_SECRET_ENV = "CLIENT_SECRET"
 CLIENT_PROFILE_ENV = "CLIENT_PROFILE"
 DEFAULT_HOSTNAME = "localhost"
 DEFAULT_PORT = 8181
-CONFIG_DIR = os.environ.get("SCRIPT_DIR")
-if CONFIG_DIR is None:
-    raise Exception(
-        "The SCRIPT_DIR environment variable is not set. Please set it to the 
Polaris's script directory."
-    )
+CONFIG_DIR = (os.environ.get("POLARIS_HOME") or "").strip() or 
os.path.expanduser("~/.polaris")
 CONFIG_FILE = os.path.join(CONFIG_DIR, ".polaris.json")
diff --git a/polaris b/polaris
index aec3b2b25..4c4678f4a 100755
--- a/polaris
+++ b/polaris
@@ -74,5 +74,4 @@ if ! command -v polaris &> /dev/null; then
   source "${dir}/polaris-venv/bin/activate"
 fi
 
-export SCRIPT_DIR="${dir}"
 exec polaris "$@"
diff --git a/site/content/in-dev/unreleased/command-line-interface.md 
b/site/content/in-dev/unreleased/command-line-interface.md
index 094b5dbdb..5f7ab65bd 100644
--- a/site/content/in-dev/unreleased/command-line-interface.md
+++ b/site/content/in-dev/unreleased/command-line-interface.md
@@ -99,7 +99,7 @@ Alternatively, you can run the CLI by providing a path to it, 
such as with the f
 
 Each of the commands `catalogs`, `principals`, `principal-roles`, 
`catalog-roles`, and `privileges` is used to manage a different type of entity 
within Polaris.
 
-In addition to these, the `profiles` command is available for managing stored 
authentication profiles, allowing login credentials to be configured for reuse. 
This provides an alternative to passing authentication details with every 
command.
+In addition to these, the `profiles` command is available for managing stored 
authentication profiles, allowing login credentials to be configured for reuse. 
This provides an alternative to passing authentication details with every 
command. By default, profiles are stored in a `.polaris.json` file within the 
`~/.polaris` directory. The location of this directory can be overridden by 
setting the `POLARIS_HOME` environment variable.
 
 To find details on the options that can be provided to a particular command or 
subcommand ad-hoc, you may wish to use the `--help` flag. For example:
 

Reply via email to