Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

iRevive
Copy link

@iRevive iRevive commented Nov 9, 2021

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.

@necosta
Copy link

necosta commented Dec 14, 2021

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
Copy link

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.

Copy link
Author

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")
    )
  )
)

Copy link

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.

@er1c
Copy link

er1c commented Aug 24, 2024

@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 project/project/plugins.sbt to import the plugin, and then set the githubTokenSource in the project/plugins.sbt to override the resolver chain to resolve a github repo - publishing is more bespoke and easier

@iRevive
Copy link
Author

iRevive commented Aug 27, 2024

@er1c no worries. I'm glad my changes are used for good :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants