Cordon can inject credentials into database connections, not just HTTP APIs. For PostgreSQL, cordon intercepts the wire protocol handshake and injects the password before the connection reaches the upstream database. Your application connects to a local port with no password and cordon handles authentication transparently.Documentation Index
Fetch the complete documentation index at: https://docs.codezero.io/llms.txt
Use this file to discover all available pages before exploring further.
How it works
- Cordon listens on a local port (e.g.,
15432) - Your app connects to
localhost:15432with no password - Cordon intercepts the PostgreSQL authentication handshake
- The real password, resolved when Cordon starts, is injected into the authentication handshake
- The authenticated connection is forwarded to the upstream database
PostgreSQL listeners currently resolve credentials at startup, not per connection. If you rotate the underlying secret, restart Cordon to pick up the new value.
Configuration
Database connections are configured as[[listeners]] entries in cordon.toml, alongside HTTP routes:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Identifier for the listener (used in logs) |
port | integer | Yes | Local port to listen on |
upstream | string | Yes | Upstream database host and port |
auth.type | string | Yes | Auth type. Currently password. |
auth.username | string | Yes | Username to authenticate as |
auth.secret | object | Yes | Secret source reference. See Secret Sources. |
Connecting your application
Point your application at the local port instead of the upstream database:- Connection string
- Environment variable