From d79ab9d850fc97fb1431d46772ea4153d24ef178 Mon Sep 17 00:00:00 2001 From: sunghyunkang1111 Date: Fri, 19 Jan 2024 10:17:45 -0600 Subject: [PATCH] Fix connection strings --- src/Explorer/Tabs/PostgresConnectTab.tsx | 13 +++++++------ src/UserContext.ts | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Explorer/Tabs/PostgresConnectTab.tsx b/src/Explorer/Tabs/PostgresConnectTab.tsx index 732b1d93f..9f8e8453f 100644 --- a/src/Explorer/Tabs/PostgresConnectTab.tsx +++ b/src/Explorer/Tabs/PostgresConnectTab.tsx @@ -16,10 +16,11 @@ import React from "react"; import { userContext } from "UserContext"; export const PostgresConnectTab: React.FC = (): JSX.Element => { - const { adminLogin, nodes, enablePublicIpAccess } = userContext.postgresConnectionStrParams; + const { adminLogin, databaseName, nodes, enablePublicIpAccess } = userContext.postgresConnectionStrParams; const [usePgBouncerPort, setUsePgBouncerPort] = React.useState(false); const [selectedNode, setSelectedNode] = React.useState(nodes?.[0]?.value); const portNumber = usePgBouncerPort ? "6432" : "5432"; + const dbName = databaseName ? databaseName : "citus"; const onCopyBtnClicked = (selector: string): void => { const textfield: HTMLInputElement = document.querySelector(selector); @@ -40,11 +41,11 @@ export const PostgresConnectTab: React.FC = (): JSX.Element => { text: node.text, })); - const postgresSQLConnectionURL = `postgres://${adminLogin}:{your_password}@${selectedNode}:${portNumber}/citus?sslmode=require`; - const psql = `psql "host=${selectedNode} port=${portNumber} dbname=citus user=${adminLogin} password={your_password} sslmode=require"`; - const jdbc = `jdbc:postgresql://${selectedNode}:${portNumber}/citus?user=${adminLogin}&password={your_password}&sslmode=require`; - const libpq = `host=${selectedNode} port=${portNumber} dbname=citus user=${adminLogin} password={your_password} sslmode=require`; - const adoDotNet = `Server=${selectedNode};Database=citus;Port=${portNumber};User Id=${adminLogin};Password={your_password};Ssl Mode=Require;`; + const postgresSQLConnectionURL = `postgres://${adminLogin}:{your_password}@${selectedNode}:${portNumber}/${dbName}?sslmode=require`; + const psql = `psql "host=${selectedNode} port=${portNumber} dbname=${dbName} user=${adminLogin} password={your_password} sslmode=require"`; + const jdbc = `jdbc:postgresql://${selectedNode}:${portNumber}/${dbName}?user=${adminLogin}&password={your_password}&sslmode=require`; + const libpq = `host=${selectedNode} port=${portNumber} dbname=${dbName} user=${adminLogin} password={your_password} sslmode=require`; + const adoDotNet = `Server=${selectedNode};Database=${dbName};Port=${portNumber};User Id=${adminLogin};Password={your_password};Ssl Mode=Require;`; return (
diff --git a/src/UserContext.ts b/src/UserContext.ts index b265ae80a..f7a635f4b 100644 --- a/src/UserContext.ts +++ b/src/UserContext.ts @@ -36,6 +36,7 @@ export interface Node { export interface PostgresConnectionStrParams { adminLogin: string; + databaseName: string; enablePublicIpAccess: boolean; nodes: Node[]; isMarlinServerGroup: boolean;