Skip to content

Commit

Permalink
add DVC_STUDIO_URL envvar support (#9340)
Browse files Browse the repository at this point in the history
add DVC_STUDIO_URL envvar
  • Loading branch information
skshetry authored Apr 18, 2023
1 parent 7841020 commit dd3deb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dvc/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
DVC_EXP_AUTO_PUSH = "DVC_EXP_AUTO_PUSH"
DVC_NO_ANALYTICS = "DVC_NO_ANALYTICS"
DVC_SHOW_TRACEBACK = "DVC_SHOW_TRACEBACK"
DVC_STUDIO_TOKEN = "DVC_STUDIO_TOKEN" # noqa: S105 # nosec B105
DVC_STUDIO_URL = "DVC_STUDIO_URL"
5 changes: 3 additions & 2 deletions dvc/repo/experiments/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from funcy import compact, group_by
from scmrepo.git.backend.base import SyncStatus

from dvc.env import DVC_STUDIO_TOKEN, DVC_STUDIO_URL
from dvc.exceptions import DvcException
from dvc.repo import locked
from dvc.repo.scm_context import scm_context
Expand Down Expand Up @@ -47,7 +48,7 @@ def notify_refs_to_studio(
return None

token = (
os.environ.get("DVC_STUDIO_TOKEN")
os.environ.get(DVC_STUDIO_TOKEN)
or os.environ.get("STUDIO_TOKEN")
or config.get("token")
)
Expand All @@ -60,7 +61,7 @@ def notify_refs_to_studio(
from dvc.utils import studio

_, repo_url = get_remote_repo(repo.scm.dulwich.repo, git_remote)
studio_url = config.get("url")
studio_url = os.environ.get(DVC_STUDIO_URL) or config.get("url")
d = studio.notify_refs(repo_url, token, base_url=studio_url, **refs)
return d.get("url")

Expand Down

0 comments on commit dd3deb6

Please sign in to comment.