For AI agents: the documentation index is at /docs/termbox/llms.txt. A Markdown version of this page is available at /docs/termbox/managed-postgresql.md or by requesting it with the Accept: text/markdown header.
Termbox Docs

Running Termbox on Managed PostgreSQL

Termbox can connect to any PostgreSQL-compatible database, both self-hosted and managed. Database connections are configured with the PG_* environment variables. Connecting to a typical PostgreSQL instance may require the following setup:

PG_HOST=<host>
PG_PORT=5432
PG_USER=termbox
PG_PASSWORD=termboxpass
PG_DATABASE=termbox

Some managed PostgreSQL instances require special authentication methods.

Databricks Lakebase Postgres

Lakebase is Databricks' managed, autoscaling Postgres offering, organized into projects, branches, and endpoints. Instead of a static password, Termbox authenticates to Lakebase as a service principal using short-lived OAuth-issued database credentials.

Termbox currently supports Lakebase Autoscaling projects (project / branch / endpoint). Since March 2026, new Lakebase instances are created as Autoscaling, and existing Provisioned instances are being upgraded to Autoscaling starting June 2026 — for that reason, Provisioned instances are not supported in Termbox.

When PG_DATABRICKS_HOST, PG_DATABRICKS_CLIENT_ID, and PG_DATABRICKS_CLIENT_SECRET are set, Termbox resolves database credentials dynamically instead of using PG_USER / PG_PASSWORD. The resolved credential is cached and reused for new pooled connections until PG_MAX_LIFETIME elapses (default 3300000 ms / 55 minutes), at which point it's transparently refreshed. PG_MAX_LIFETIME should be kept below Databricks' token expiry (1 hour).

1

Create a Lakebase project, branch, and endpoint

In the Databricks workspace, set up a Lakebase Postgres project with a branch and endpoint. Note their IDs — you'll need them as PG_DATABRICKS_PROJECT, PG_DATABRICKS_BRANCH, and PG_DATABRICKS_ENDPOINT. See Connect an external application for how to find these, along with the Postgres host, port, and database name.

2

Create a service principal

Create a service principal with an OAuth secret. Note its client ID and client secret. And register the service principal as a Postgres role.

3

Configure termbox

PG_HOST=<instance>.database.cloud.databricks.com
PG_PORT=5432
PG_DATABASE=databricks_postgres
PG_DATABRICKS_HOST=https://<workspace>.cloud.databricks.com
PG_DATABRICKS_PROJECT=termbox
PG_DATABRICKS_BRANCH=production
PG_DATABRICKS_ENDPOINT=primary
PG_DATABRICKS_CLIENT_ID=<service-principal-client-id>
PG_DATABRICKS_CLIENT_SECRET=<service-principal-client-secret>

PG_USER and PG_PASSWORD are ignored once the PG_DATABRICKS_* variables above are set — termbox falls back to them only when Databricks credentials aren't configured.

Last updated: