-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use awsProfile in s3region and s3credentials #57
Changes from all commits
1f405e6
9f5494d
bdc1cc4
1464b29
37d5adb
ab23fb5
4fc7f7c
e1e8e45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,10 @@ package ohnosequences.sbt | |
import sbt._ | ||
import Keys._ | ||
import java.util.Optional | ||
import com.amazonaws.auth._, profile._ | ||
import com.amazonaws.regions.{ Region, Regions, RegionUtils, AwsRegionProvider } | ||
|
||
import com.amazonaws.auth._ | ||
import com.amazonaws.auth.profile.ProfileCredentialsProvider | ||
import com.amazonaws.regions._ | ||
import com.amazonaws.services.s3.AmazonS3 | ||
|
||
|
||
|
@@ -21,6 +23,9 @@ object SbtS3Resolver extends AutoPlugin { | |
@deprecated("s3acl is now an Option. Please define it either Some(...) or None if you wish to inherit the bucket default.", "0.18.0") | ||
implicit def acl2Option(acl: S3ACL): Option[S3ACL] = Some(acl) | ||
|
||
@deprecated("awsProfile is now an Option. Please define it either Some(...).", "0.19.0") | ||
implicit def awsProfile2Option(profile: String): Option[String] = Some(profile) | ||
|
||
case class S3Resolver( | ||
credentialsProvider: AWSCredentialsProvider, | ||
overwrite: Boolean, | ||
|
@@ -85,7 +90,7 @@ object SbtS3Resolver extends AutoPlugin { | |
implicit def fromProviderToAWSRegion(provider: AwsRegionProvider): Region = regionFromString(provider.getRegion()) | ||
|
||
// Adding setting keys | ||
lazy val awsProfile = settingKey[String]("AWS credentials profile") | ||
lazy val awsProfile = settingKey[Option[String]]("AWS credentials profile") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding your concern about breaking change: take a look at the trick we did in #55 (comment) (here). You can add an implicit conversion from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added an implicit conversion from |
||
lazy val s3credentials = settingKey[AWSCredentialsProvider]("AWS credentials provider to access S3") | ||
lazy val s3region = settingKey[Region]("AWS Region for your S3 resolvers") | ||
lazy val s3overwrite = settingKey[Boolean]("Controls whether publishing resolver can overwrite artifacts") | ||
|
@@ -129,12 +134,16 @@ object SbtS3Resolver extends AutoPlugin { | |
|
||
// Default settings | ||
override def projectSettings: Seq[Setting[_]] = Seq( | ||
awsProfile := "default", | ||
awsProfile := None, | ||
s3credentials := | ||
new ProfileCredentialsProvider(awsProfile.value) | | ||
new EnvironmentVariableCredentialsProvider() | | ||
InstanceProfileCredentialsProvider.getInstance(), | ||
s3region := new com.amazonaws.regions.DefaultAwsRegionProviderChain(), | ||
(awsProfile.value match { | ||
case Some(profile) => new ProfileCredentialsProvider(profile) | ||
case _ => new DefaultAWSCredentialsProviderChain() | ||
}), | ||
s3region := (awsProfile.value match { | ||
case Some(profile) => new AwsProfileRegionProvider(profile) | ||
case _ => new DefaultAwsRegionProviderChain() | ||
}), | ||
s3overwrite := isSnapshot.value, | ||
s3sse := false, | ||
s3acl := Some(com.amazonaws.services.s3.model.CannedAccessControlList.PublicRead), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The end of message (about bucket default) is not related to this setting. Just remove the part about None: "Please define it explicitly with Some(...).". None is default and doesn't use this conversion, so user doesn't need to see this warning if he didn't touch the setting.