Skip to content

Commit

Permalink
Fix "tsh db connect" to MongoDB databases when cluster has separate M…
Browse files Browse the repository at this point in the history
…ongoDB port (#48129)
  • Loading branch information
greedy52 authored Nov 13, 2024
1 parent 772c3c4 commit 25235fd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tool/tsh/common/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ func maybeStartLocalProxy(ctx context.Context, cf *CLIConf,
host := "localhost"
cmdOpts := []dbcmd.ConnectCommandFunc{
dbcmd.WithLocalProxy(host, addr.Port(0), profile.CACertPathForCluster(rootClusterName)),
dbcmd.WithGetDatabaseFunc(dbInfo.getDatabaseForDBCmd),
}
if requires.tunnel {
cmdOpts = append(cmdOpts, dbcmd.WithNoTLS())
Expand Down Expand Up @@ -777,7 +776,10 @@ func onDatabaseConnect(cf *CLIConf) error {
if err != nil {
return trace.Wrap(err)
}
opts = append(opts, dbcmd.WithLogger(log))
opts = append(opts,
dbcmd.WithLogger(log),
dbcmd.WithGetDatabaseFunc(dbInfo.getDatabaseForDBCmd),
)

if opts, err = maybeAddDBUserPassword(cf, tc, dbInfo, opts); err != nil {
return trace.Wrap(err)
Expand Down

0 comments on commit 25235fd

Please sign in to comment.