Skip to content

Commit 90c981a

Browse files
CLI: Remove SCRIPT_DIR and default config location to user home (#2448)
1 parent cbdc12b commit 90c981a

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ client-regenerate: client-setup-env ## Regenerate the client code
140140
.PHONY: client-unit-test
141141
client-unit-test: client-setup-env ## Run client unit tests
142142
@echo "--- Running client unit tests ---"
143-
@$(ACTIVATE_AND_CD) && SCRIPT_DIR="non-existing-mock-directory" poetry run pytest test/
143+
@$(ACTIVATE_AND_CD) && poetry run pytest test/
144144
@echo "--- Client unit tests complete ---"
145145

146146
.PHONY: client-integration-test

client/python/cli/command/profiles.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def _load_profiles(self) -> Dict[str, Dict[str, str]]:
5656
if not os.path.exists(CONFIG_FILE):
5757
return {}
5858
with open(CONFIG_FILE, "r") as f:
59+
print(f"Loading profiles from {CONFIG_FILE}")
5960
return json.load(f)
6061

6162
def _save_profiles(self, profiles: Dict[str, Dict[str, str]]) -> None:

client/python/cli/constants.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,5 @@ class Namespaces:
371371
CLIENT_PROFILE_ENV = "CLIENT_PROFILE"
372372
DEFAULT_HOSTNAME = "localhost"
373373
DEFAULT_PORT = 8181
374-
CONFIG_DIR = os.environ.get("SCRIPT_DIR")
375-
if CONFIG_DIR is None:
376-
raise Exception(
377-
"The SCRIPT_DIR environment variable is not set. Please set it to the Polaris's script directory."
378-
)
374+
CONFIG_DIR = (os.environ.get("POLARIS_HOME") or "").strip() or os.path.expanduser("~/.polaris")
379375
CONFIG_FILE = os.path.join(CONFIG_DIR, ".polaris.json")

polaris

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,4 @@ if ! command -v polaris &> /dev/null; then
7474
source "${dir}/polaris-venv/bin/activate"
7575
fi
7676

77-
export SCRIPT_DIR="${dir}"
7877
exec polaris "$@"

site/content/in-dev/unreleased/command-line-interface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Alternatively, you can run the CLI by providing a path to it, such as with the f
9999

100100
Each of the commands `catalogs`, `principals`, `principal-roles`, `catalog-roles`, and `privileges` is used to manage a different type of entity within Polaris.
101101

102-
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.
102+
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.
103103

104104
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:
105105

0 commit comments

Comments
 (0)