console: bugfix to resolve error when using connection parameters with postgres/citus

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9465
GitOrigin-RevId: 8ee65b734314e6bfc7bd2806dc0ba77334e30c5c
This commit is contained in:
Matthew Goodwin 2023-06-07 16:48:33 -05:00 committed by hasura-bot
parent 4613aaf56e
commit dc7a1f2270

View File

@ -5,46 +5,46 @@ import { cleanEmpty } from './helpers';
export const generateConnectionInfo = ( export const generateConnectionInfo = (
values: PostgresConnectionSchema['configuration']['connectionInfo'] values: PostgresConnectionSchema['configuration']['connectionInfo']
) => { ) => ({
return { database_url:
database_url: values.databaseUrl.connectionType === 'databaseUrl'
values.databaseUrl.connectionType === 'databaseUrl' ? values.databaseUrl.url
? values.databaseUrl.url : values.databaseUrl.connectionType === 'envVar'
: values.databaseUrl.connectionType === 'envVar' ? { from_env: values.databaseUrl.envVar }
? { from_env: values.databaseUrl.envVar } : {
: { connection_parameters: {
username: values.databaseUrl.username, username: values.databaseUrl.username,
password: values.databaseUrl.password, password: values.databaseUrl.password,
database: values.databaseUrl.database, database: values.databaseUrl.database,
port: values.databaseUrl.port, port: values.databaseUrl.port,
host: values.databaseUrl.host, host: values.databaseUrl.host,
}, },
pool_settings: { },
total_max_connections: values.poolSettings?.totalMaxConnections, pool_settings: {
idle_timeout: values.poolSettings?.idleTimeout, total_max_connections: values.poolSettings?.totalMaxConnections,
retries: values.poolSettings?.retries, idle_timeout: values.poolSettings?.idleTimeout,
pool_timeout: values.poolSettings?.poolTimeout, retries: values.poolSettings?.retries,
connection_lifetime: values.poolSettings?.connectionLifetime, pool_timeout: values.poolSettings?.poolTimeout,
connection_lifetime: values.poolSettings?.connectionLifetime,
},
use_prepared_statements: values.usePreparedStatements,
isolation_level: values.isolationLevel,
ssl_configuration: {
sslmode: values.sslSettings?.sslMode,
sslrootcert: {
from_env: values.sslSettings?.sslRootCert,
}, },
use_prepared_statements: values.usePreparedStatements, sslcert: {
isolation_level: values.isolationLevel, from_env: values.sslSettings?.sslCert,
ssl_configuration: {
sslmode: values.sslSettings?.sslMode,
sslrootcert: {
from_env: values.sslSettings?.sslRootCert,
},
sslcert: {
from_env: values.sslSettings?.sslCert,
},
sslkey: {
from_env: values.sslSettings?.sslKey,
},
sslpassword: {
from_env: values.sslSettings?.sslPassword,
},
}, },
}; sslkey: {
}; from_env: values.sslSettings?.sslKey,
},
sslpassword: {
from_env: values.sslSettings?.sslPassword,
},
},
});
export const generatePostgresRequestPayload = ({ export const generatePostgresRequestPayload = ({
driver, driver,