From 5b010fef1fcb0112962c93c56ea4a6c5ba1a9f4e Mon Sep 17 00:00:00 2001 From: Brandon Stilson Date: Sat, 2 Dec 2023 12:08:52 -0800 Subject: [PATCH] sbt credentials --- .../src/main/scala/codeartifact/CodeArtifactPlugin.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala index 77bf616..cdf8092 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala @@ -25,8 +25,11 @@ object CodeArtifactPlugin extends AutoPlugin { codeArtifactPublish := dynamicallyPublish.value, codeArtifactRepo := CodeArtifactRepo.fromUrl(codeArtifactUrl.value), codeArtifactToken := sys.env + .get("CODEARTIFACT_AUTH_TOKEN") + .orElse( + Credentials.loadCredentials(Path.userHome / ".sbt" / "credentials").toOption.map(_.passwd) + ) .getOrElse( - "CODEARTIFACT_AUTH_TOKEN", CodeArtifact.getAuthToken(codeArtifactRepo.value) ), codeArtifactConnectTimeout := CodeArtifact.Defaults.CONNECT_TIMEOUT,