-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add TokenSource.Property #43
base: master
Are you sure you want to change the base?
Conversation
Hi @djspiewak , can we merge and publish this change? Was debugging an issue with IntelliJ and was thinking the exact same solution as @iRevive suggests here. Many thanks. |
@@ -23,6 +23,7 @@ sealed trait TokenSource extends Product with Serializable { | |||
|
|||
object TokenSource { | |||
final case class Environment(variable: String) extends TokenSource | |||
final case class Property(key: String) extends TokenSource | |||
final case class GitConfig(key: String) extends TokenSource | |||
final case class Or(primary: TokenSource, secondary: TokenSource) extends TokenSource |
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.
Nice to Have. A Or
method with the three parameters.
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.
Two parameters should be enough:
val source: TokenSource = TokenSource.Environment("TOKEN_1") || TokenSource.GitConfig("config") ||
TokenSource.Property("PROPERTY_TOKEN") || TokenSource.Environment("TOKEN_2")
Encoded as:
val source: TokenSource = TokenSource.Or(
TokenSource.Environment("TOKEN_1"),
TokenSource.Or(
TokenSource.GitConfig("config"),
TokenSource.Or(
TokenSource.Property("PROPERTY_TOKEN"),
TokenSource.Environment("TOKEN_2")
)
)
)
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.
Yes, good point. That would work.
@iRevive I stole part of this idea for https://github.com/er1c/sbt-github/pull/2/files is that ok? it was interesting to work through some of the sbt tests, you have to nest a |
@er1c no worries. I'm glad my changes are used for good :) |
The aim of the PR is to solve IntelliJ IDEA importing issue.
IDEA correctly picks up properties from
.sbtopts
file and therefore can download dependencies from the GitHub maven repository.Partially solves #24, #26, and #42.