Skip to content

Commit 9f798e0

Browse files
committed
Support custom credentials
1 parent cb6f693 commit 9f798e0

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

src/browsergym/workarena/install.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,26 @@
5959
_CLI_INSTANCE_PASSWORD: str | None = None
6060

6161

62-
def SNowInstance():
62+
def SNowInstance(snow_credentials: tuple[str, str] | None = None):
6363
"""
64-
Wrapper around the standard SNowInstance that always uses CLI-provided credentials.
64+
Wrapper around the standard SNowInstance that prefers explicit credentials.
6565
"""
66-
if not _CLI_INSTANCE_URL or not _CLI_INSTANCE_PASSWORD:
67-
raise RuntimeError("Installer requires --instance-url and --instance-password arguments.")
66+
if not _CLI_INSTANCE_URL:
67+
raise RuntimeError("Installer requires --instance-url to create a SNowInstance.")
68+
69+
resolved_url = _CLI_INSTANCE_URL
70+
resolved_creds = snow_credentials
71+
72+
if resolved_creds is None:
73+
if not _CLI_INSTANCE_PASSWORD:
74+
raise RuntimeError(
75+
"Installer requires --instance-password (or explicit credentials) to create a SNowInstance."
76+
)
77+
resolved_creds = ("admin", _CLI_INSTANCE_PASSWORD)
78+
6879
return _BaseSNowInstance(
69-
snow_url=_CLI_INSTANCE_URL,
70-
snow_credentials=("admin", _CLI_INSTANCE_PASSWORD),
80+
snow_url=resolved_url,
81+
snow_credentials=resolved_creds,
7182
)
7283

7384

0 commit comments

Comments
 (0)