connection-string
print a connection string
Print a connection string for a database.
By default this is the pooled route, "for your app". Use --direct for the
route "for tools and migrations" (session features such as LISTEN/NOTIFY and
advisory locks, pg_dump, schema migrations). The hosts are private to the
environment; from a laptop use csph db tunnel.
--public prints the public endpoint's string instead (only while
csph db public is on), with sslmode=verify-full: the pooled route where
the endpoint has one, otherwise the direct route; --direct for the direct
route. Where the database's certificate comes from its own CA, the string
carries sslrootcert=<file name>: --save-ca saves that CA file in the current
directory (or --save-ca=<path>). Otherwise it uses sslrootcert=system, which
needs libpq 16+; older libpq needs sslrootcert=<path to your CA bundle>.
Usage
csph db connection-string <name|id> [flags]
Options
Command Specific
Formatting
For more information about formatting options, see Formatting.
Inherited
Examples
csph db connection-string orders
csph db connection-string orders --direct --reveal
csph db connection-string orders --public --direct
csph db connection-string orders --public --save-ca
See also
- csph db — manage SphereDB databases
- csph db list — list databases
- csph db get — show a database
- csph db create — create a SphereDB database
- csph db delete — delete a database
- csph db instance-types — list database instance types and prices
- csph db resize — change a database's instance type, high availability or storage
- csph db credentials — manage database credentials
- csph db connect — open psql on a database
- csph db tunnel — open a local port to a database
- csph db public — manage the public endpoint (IP allowlist)