Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7564292

Browse files
committed
Merge branch 'nik-improve-ssh-port-forwarding-snippet-to-dblab-api' into 'master'
Improve SSH port forwarding snippet – use the actual port See merge request postgres-ai/database-lab!764
2 parents 947630e + 0730735 commit 7564292

File tree

1 file changed

+8
-3
lines changed
  • ui/packages/shared/pages/Instance/Info/Connection/ConnectModal/Content

1 file changed

+8
-3
lines changed

β€Žui/packages/shared/pages/Instance/Info/Connection/ConnectModal/Content/utils.tsβ€Ž

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@
55
*--------------------------------------------------------------------------
66
*/
77

8-
98
import { Instance } from '@postgres.ai/shared/types/api/entities/instance'
109

1110
export const getCliInitCommand = (instance: Instance) =>
1211
`dblab init --url ${instance.url} --token TOKEN --environment-id ${instance.projectName}`
1312

1413
export const getSshPortForwardingCommand = (instance: Instance) => {
15-
if (!instance.sshServerUrl) return null
16-
return `ssh -NTML 2348:localhost:2345 ${instance.sshServerUrl} -i ~/.ssh/id_rsa`
14+
if (instance.sshServerUrl) {
15+
// Parse the URL to get the port
16+
const url = new URL(instance.url)
17+
const port = url.port || '2345'
18+
return `ssh -NTML ${port}:localhost:${port} ${instance.sshServerUrl} -i ~/.ssh/id_rsa`
19+
} else {
20+
return null
21+
}
1722
}

0 commit comments

Comments
(0)

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /