Skip to content

Commit 97d56eb

Browse files
committed
Use the same user agent in both places
Signed-off-by: David Gageot <[email protected]>
1 parent 2960841 commit 97d56eb

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

cmd/docker-mcp/internal/docker/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func NewClient(cli command.Cli) Client {
4242
apiClient: sync.OnceValue(func() client.APIClient {
4343
_ = cli.Apply(func(cli *command.DockerCli) error {
4444
if mobyClient, ok := cli.Client().(*client.Client); ok {
45-
_ = client.WithUserAgent("mcp/" + version.Version)(mobyClient)
45+
_ = client.WithUserAgent(version.UserAgent())(mobyClient)
4646
}
4747
return nil
4848
})

cmd/docker-mcp/internal/signatures/signatures.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
"github.com/sigstore/sigstore/pkg/cryptoutils"
1717
"github.com/sigstore/sigstore/pkg/signature"
1818
"golang.org/x/sync/errgroup"
19+
20+
"github.com/docker/mcp-gateway/cmd/docker-mcp/version"
1921
)
2022

2123
// https://raw.githubusercontent.com/docker/keyring/refs/heads/main/public/mcp/latest.pub
@@ -59,7 +61,7 @@ func Verify(ctx context.Context, images []string) error {
5961
ociremote.WithTargetRepository(signatures),
6062
ociremote.WithRemoteOptions(
6163
remote.WithContext(ctxVerify),
62-
remote.WithUserAgent("docker/mcp_gateway"),
64+
remote.WithUserAgent(version.UserAgent()),
6365
// remote.WithAuthFromKeychain(authn.DefaultKeychain),
6466
),
6567
},

cmd/docker-mcp/version/version.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
package version
22

33
var Version = "HEAD"
4+
5+
func UserAgent() string {
6+
return "docker/mcp_gateway/v/" + Version
7+
}

0 commit comments

Comments
 (0)