From 676645b1ca3b20d39fd7916fe647cfb103a82e2d Mon Sep 17 00:00:00 2001 From: George Geddes Date: Fri, 14 Jun 2024 20:29:56 -0400 Subject: [PATCH] Read studio hostname from config when not present on cli or env (#10459) --- dvc/commands/studio.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dvc/commands/studio.py b/dvc/commands/studio.py index 2f38dea41..fefad181f 100644 --- a/dvc/commands/studio.py +++ b/dvc/commands/studio.py @@ -18,11 +18,16 @@ class CmdStudioLogin(CmdConfig): from dvc.utils.studio import STUDIO_URL from dvc_studio_client.auth import StudioAuthError, get_access_token + studio = self.config.get("studio", {}) name = self.args.name - hostname = self.args.hostname or os.environ.get(DVC_STUDIO_URL) or STUDIO_URL + hostname = ( + self.args.hostname + or os.environ.get(DVC_STUDIO_URL) + or studio.get("url") + or STUDIO_URL + ) scopes = self.args.scopes - studio = self.config.get("studio", {}) if studio.get("url", hostname) == hostname and "token" in studio: raise DvcException( "Token already exists. "