Skip to main content
Manage the PostgreSQL listeners that tell cordon which database connections to intercept and what credentials to inject. Prefer these commands over editing cordon.toml directly. They validate listener ports, upstreams, TLS mode, and secret references, and are intended to make listener configuration safer and less error-prone. All cordon listener subcommands accept --scope project|user to select which config file they target, matching cordon start and cordon setup. --config and --scope are mutually exclusive — passing both is an error. Resolution:
  1. --config <path> — explicit path.
  2. --scope <scope> — resolves to the scope’s default config path (project → $CWD/cordon.toml, user → ~/.config/cordon/cordon.toml).
  3. Neither flag — defaults to project scope ($CWD/cordon.toml).
cordon listener add --config <path> can create a default config skeleton when that explicit path is missing. With default project scope or --scope, run cordon setup first. Other listener subcommands require the resolved config file to already exist.

cordon listener add

Add a new PostgreSQL listener. With no flags, launches an interactive wizard that prompts for name, port, upstream address, client TLS mode, username, secret source, and source-specific fields.

Non-interactive mode

Pass flags to skip the wizard:
--client-tls require requires valid tls.ca_cert_path and tls.ca_key_path in cordon.toml. When client_tls is omitted, Cordon treats it as accept. Cordon always requires TLS from Cordon to the upstream PostgreSQL server before it sends startup or authentication data. There is no command-line or configuration option to disable upstream PostgreSQL TLS.

Examples

After adding a keyring-backed listener, store the secret with cordon secret set ACCOUNT. Use cordon listener show NAME to find the keyring account. 1Password listeners don’t need this step — credentials are fetched from 1Password directly.

cordon listener edit

Edit an existing listener. With no flags (other than --scope or --config), launches an interactive editor that pre-fills current values — press Enter to keep a value, or type a new one.

Non-interactive mode

Pass flags to change only specific fields without prompting:

Partial updates

Non-interactive edit changes only the fields you specify. Unspecified fields keep their current values. Partial 1Password updates work the same as for routes:

Switching secret sources

When switching from one source to another with --source:
  • 1password to keyring: --account defaults to the listener name if omitted
  • keyring to 1password: requires --vault, --item, and --field

Examples

cordon listener list

List all configured listeners.

cordon listener show

Show details of a single listener.

cordon listener remove

Remove a listener by name.