tp-connect
v0.1.2
Published
Open one or more database URLs from .env in TablePlus.
Maintainers
Readme
tp-connect
tp-connect opens database connection URLs from your .env file in TablePlus.
It is meant for people who already keep database credentials as connection strings and want a quick way to choose one or more connections from the terminal.
Requirements
- macOS
- TablePlus installed
- Node.js 20+
Install
Install it globally:
npm install -g tp-connectThen run:
tp-connectHow It Works
- Put a
.envfile in the directory where you want to runtp-connect. - Add one or more database connection URLs to that file.
- Run
tp-connect. - Select the connections you want with the checkbox prompt.
- Press
Enterto open them in TablePlus.
Selected connections are opened in TablePlus tabbed mode.
Example .env
You can use any variable names. tp-connect looks for values that are valid database URLs.
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/app
ANALYTICS_URL=mysql://analytics:analytics@localhost:3306/warehouse
REPORTING_URL=mongodb://reporter:reporter@localhost:27017/reportingVariable Expansion
You can build one connection string from smaller variables in the same .env file:
PG_USER=postgres
PG_PASSWORD=postgres
PG_HOST=localhost
PG_PORT=5432
PG_DB=app
DATABASE_URL=postgresql://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/${PG_DB}Supported expansion syntax:
$VAR${VAR}
Rules:
- Expansion only uses variables from the same
.envfile. - Missing variables expand to an empty string.
- Cyclic references fail with a clear error.
What Gets Shown In The Prompt
The selection list shows:
- the environment variable name
- a sanitized summary of the target connection
Credentials are never shown in the prompt labels or normal success output.
Notes
- Run
tp-connectfrom the same directory as your.envfile. - If no valid database URLs are found, nothing will be shown to select.
- The current version supports macOS because it launches TablePlus with the macOS
opencommand.
