Skip to content

Commit

Permalink
Format CredPlugin.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
ilx committed Aug 9, 2024
1 parent 9e5ac4f commit db67a2f
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions project/CredPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ object CredPlugin extends AutoPlugin {
override def trigger = allRequirements

override def buildSettings: Seq[Setting[_]] = {
val maybeCredentials = (sys.env.get("NEXUS_HOST"), sys.env.get("NEXUS_USERNAME"), sys.env.get("NEXUS_PASSWORD")) match {
case (Some(host), Some(user), Some(password)) =>
Some(Credentials("Sonatype Nexus Repository Manager", host, user, password))
case _ =>
val credentialsFile = Path.userHome / ".sbt" / ".chill-credentials"
if (credentialsFile.exists()) {
Some(Credentials(credentialsFile))
} else {
None
}
}
maybeCredentials.fold(Seq.empty[Def.Setting[_]])(c => Seq(credentials += c))
val maybeCredentials =
(sys.env.get("NEXUS_HOST"), sys.env.get("NEXUS_USERNAME"), sys.env.get("NEXUS_PASSWORD")) match {
case (Some(host), Some(user), Some(password)) =>
Some(Credentials("Sonatype Nexus Repository Manager", host, user, password))
case _ =>
val credentialsFile = Path.userHome / ".sbt" / ".chill-credentials"
if (credentialsFile.exists()) {
Some(Credentials(credentialsFile))
} else {
None
}
}
maybeCredentials.fold(Seq.empty[Def.Setting[_]])(c => Seq(credentials += c))
}
}

0 comments on commit db67a2f

Please sign in to comment.