Skip to content

Commit 08bbc93

Browse files
authored
Merge pull request #112 from ServiceNow/new-dispatcher
Support custom credentials in installer
2 parents 8dfb5fb + 87f119e commit 08bbc93

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/browsergym/workarena/install.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,25 @@
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 uses CLI-provided instance URL and password if none are provided.
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_creds = snow_credentials
70+
71+
if resolved_creds is None:
72+
if not _CLI_INSTANCE_PASSWORD:
73+
raise RuntimeError(
74+
"Installer requires --instance-password (or explicit credentials) to create a SNowInstance."
75+
)
76+
resolved_creds = ("admin", _CLI_INSTANCE_PASSWORD)
77+
6878
return _BaseSNowInstance(
6979
snow_url=_CLI_INSTANCE_URL,
70-
snow_credentials=("admin", _CLI_INSTANCE_PASSWORD),
80+
snow_credentials=resolved_creds,
7181
)
7282

7383

0 commit comments

Comments
 (0)