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

smithy4sUpdateLSPConfig: support credentials #1565

Open
kubukoz opened this issue Jul 1, 2024 · 0 comments
Open

smithy4sUpdateLSPConfig: support credentials #1565

kubukoz opened this issue Jul 1, 2024 · 0 comments

Comments

@kubukoz
Copy link
Member

kubukoz commented Jul 1, 2024

Some repositories may need credentials (which can be configured with "httpCredentials": "user:pass"), so if we generate their config, it would be valuable to write creds too.

I think this should require an explicit opt-in, such as a setting like smithy4sLSPConfigCredentials := true.

Alternatively, we should detect already-existing repositories with credentials, and not add duplicate entries for them (right now, I see such entries being added).

To reproduce:

project/plugins.sbt:

addSbtPlugin(
  "com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.23"
)

build.sbt:

val root = project
  .in(file("."))
  .enablePlugins(Smithy4sCodegenPlugin)
  .settings(
    resolvers ++= Resolver.sonatypeOssRepos("snapshots")
  )

smithy-build.json:

{
  "version": "1.0",
  "sources": ["src/main/smithy", "target/scala-2.12/src_managed/main/smithy"],
  "maven": {
    "dependencies": [
      "com.disneystreaming.alloy:alloy-core:0.3.8",
      "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.23",
      "com.disneystreaming.alloy:alloy-core:0.3.9"
    ],
    "repositories": [
      {
        "url": "https://oss.sonatype.org/content/repositories/snapshots",
        "httpCredentials": "myusername:mypass"
      },
      {
        "url": "https://s01.oss.sonatype.org/content/repositories/snapshots"
      }
    ]
  }
}

Run sbt smithy4sUpdateLSPConfig, your smithy-build changes to (formatted):

{
  "version": "1.0",
  "sources": ["src/main/smithy", "target/scala-2.12/src_managed/main/smithy"],
  "maven": {
    "dependencies": [
      "com.disneystreaming.alloy:alloy-core:0.3.8",
      "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.23",
      "com.disneystreaming.alloy:alloy-core:0.3.9"
    ],
    "repositories": [
      {
        "url": "https://oss.sonatype.org/content/repositories/snapshots",
        "httpCredentials": "myusername:mypass"
      },
      {
        "url": "https://s01.oss.sonatype.org/content/repositories/snapshots"
      },
      {
        "url": "https://oss.sonatype.org/content/repositories/snapshots"
      }
    ]
  }
}

i.e. the last entry is added, duplicating / conflicting with the first one.

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

No branches or pull requests

1 participant