mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
* Slight refactor to DatabaseConnectionString * Add IPv4 deprecation warning to database connection strings + link to pooler settings * Add description in connection pool url to show the format * Add badges to connection settings and connection pooling settings RE resolving to ipv4 or ipv6 * Add default pooler size as placeholder in connection pooling depending on compute instance size * Fix badge * Add note to use session pool mode in pooler settings if using prepared statements in db * Shift connection pooling settings up top and change titles of panels * Fix * Update pooling size default value based on compute size * Show max client conns for supavisor pooling settings * Adjust copywriting * Combine database settings and connection strings sections * Address comments * Update description to use 5432 as alternative for pooling when using prepared statements * Fix
42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
export const getConnectionStrings = (connectionInfo: {
|
|
db_user: string
|
|
db_port: number
|
|
db_host: string
|
|
db_name: string
|
|
}) => {
|
|
const uriConnString =
|
|
`postgresql://${connectionInfo.db_user}:[YOUR-PASSWORD]@` +
|
|
`${connectionInfo.db_host}:${connectionInfo.db_port.toString()}` +
|
|
`/${connectionInfo.db_name}`
|
|
const golangConnString =
|
|
`user=${connectionInfo.db_user} password=[YOUR-PASSWORD] ` +
|
|
`host=${connectionInfo.db_host} port=${connectionInfo.db_port.toString()}` +
|
|
` dbname=${connectionInfo.db_name}`
|
|
const psqlConnString =
|
|
`psql -h ${connectionInfo.db_host} -p ` +
|
|
`${connectionInfo.db_port.toString()} -d ${connectionInfo.db_name} ` +
|
|
`-U ${connectionInfo.db_user}`
|
|
const jdbcConnString =
|
|
`jdbc:postgresql://${connectionInfo.db_host}:${connectionInfo.db_port.toString()}` +
|
|
`/${connectionInfo.db_name}?user=${connectionInfo.db_user}&password=[YOUR-PASSWORD]`
|
|
const dotNetConnString =
|
|
`User Id=${connectionInfo.db_user};Password=[YOUR-PASSWORD];` +
|
|
`Server=${connectionInfo.db_host};Port=${connectionInfo.db_port.toString()};` +
|
|
`Database=${connectionInfo.db_name}`
|
|
const pythonConnString =
|
|
`user=${connectionInfo.db_user} password=[YOUR-PASSWORD]` +
|
|
` host=${connectionInfo.db_host} port=${connectionInfo.db_port.toString()}` +
|
|
` database=${connectionInfo.db_name}`
|
|
|
|
return {
|
|
psql: psqlConnString,
|
|
uri: uriConnString,
|
|
golang: golangConnString,
|
|
jdbc: jdbcConnString,
|
|
dotnet: dotNetConnString,
|
|
nodejs: uriConnString,
|
|
php: golangConnString,
|
|
python: pythonConnString,
|
|
}
|
|
}
|