Skip to content

Project-Local Targets

Project-local targets are useful when a repository has its own development database, scratch SQLite file, or warehouse schema.

From inside a git repository:

Terminal window
tonic connections add postgres app-dev \
--host localhost \
--user app \
--password-env PGPASSWORD \
--context database=app_dev \
--context schema=public \
--local

This writes <repo-root>/.tonic/config.yaml.

Terminal window
tonic connections show

The same target name may exist globally and locally. The local target replaces the global target for commands run inside that repo.

Config stores secret references, not raw credentials.

connections:
app-dev:
backend: postgres
secrets:
password_env: PGPASSWORD

Each developer can provide PGPASSWORD through their shell, direnv, or secret manager.

Use a shared target name in scripts and let local config decide where it points.

Terminal window
tonic query exec --target app-dev --sql 'select current_database()'