Out Plane
db

db url

Print a connection string.

read onlyrepeatable

A connection string, printed on its own so it can go straight into a variable or an environment file. This is the only command that returns a password, and asking for it is the request to see it.

While the instance has one role and one database, neither has to be named. With a choice, this refuses and lists them rather than picking.

Usage

outplane db url <DATABASE> [flags]

Arguments

ArgumentTypeDescription
DATABASEstringDatabase name or id. Required.

Flags

FlagTypeDescription
--rolestringWhich login to build it for. Optional when there is only one.
--databasestringWhich database inside the instance. Optional when there is only one.

The global flags apply as well.

Output

FieldTypeDescription
urlstringCarries the role's password.
rolestring
databasestring
dbstringThe instance it belongs to.

This command prints a bare value in every format, so it can be read straight into a variable. It has no JSON form.

Examples

The only role and database

outplane db url orders

Read the parts rather than the string

outplane db url orders --json --fields role,database,db
{
  "database": "main",
  "db": "orders",
  "role": "app"
}

Name them when there is a choice

outplane db url orders --role app --database main

What to Know

  • Text is the default even in a pipe, unlike most commands, so command substitution captures the string rather than an object. Pass --json for the object.
  • --role and --database are optional only while there is exactly one of each. With a choice the command refuses and lists them rather than picking.
  • The string is a credential and is never masked here: asking for it is the request to see it. It does not appear in any other command's output.
  • Because the piped default is text, a failure is a sentence on stderr rather than a JSON envelope on stdout, and stdout stays empty. That is what keeps command substitution from capturing an error message. Pass --json when the envelope is wanted.
  • To hand it to an application, capture it and pass it to outplane env set, which takes a KEY=VALUE pair and can deploy afterwards.

Errors

Beyond 0 for success, this command exits with:

ExitKindMeaning
2usageInvalid arguments, unknown flag, or client-side validation failure.
3authNot authenticated, token revoked or expired, or forbidden for this team.
5not_foundThe named resource does not exist, or is not visible to this credential.
8upstreamThe Out Plane API returned a server error.

The code on the error object is one of db.not_found, db.role_required, db.database_required, usage.missing_argument. Branch on that, or on the exit status. The message is prose and changes.

On this page