DbGate

functional

Read and write the documented DbGate connection variables (CONNECTIONS, SERVER_, ENGINE_ and friends) as an .env file.

DbGate documents a set of environment variables that predefine connections, mostly used to ship a DbGate server or Docker container with its connections built in: a CONNECTIONS list of ids, then LABEL_, ENGINE_, SERVER_, PORT_, USER_, DATABASE_ and friends for each id. SQLly reads and writes those variables as an .env file.

CONNECTIONS=orders,cache
LABEL_orders=Orders
ENGINE_orders=postgres@dbgate-plugin-postgres
SERVER_orders=pg1.acme.internal
PORT_orders=5432
USER_orders=app
DATABASE_orders=orders
LABEL_cache=Cache
ENGINE_cache=redis@dbgate-plugin-redis
SERVER_cache=redis.acme.internal
PORT_cache=6379

From DbGate into SQLly

Put the variables in a text file, one per line (a Docker --env-file, a .env, or lines copied from a compose file's environment: block; export prefixes, quotes and # comments are fine), then choose File → Import From Other Tools… and pick it. SQLly reads the label, engine, host, port, user, default database, SQLite file, read-only flag, SSL certificate files, and SSH tunnel settings (USE_SSH_, SSH_HOST_, SSH_PORT_, SSH_LOGIN_, SSH_MODE_, SSH_KEY_FILE_). ClickHouse, DuckDB and libSQL engine ids are read too, and AUTH_TYPE_=sspi imports as Windows integrated sign-in. PASSWORD_ and the other secret variables are skipped, and MongoDB connections are listed as skipped because SQLly does not connect to MongoDB.

From SQLly into DbGate

Choose File → Export for Other Tools → DbGate (.env)…. The picker lists the engines DbGate documents an ENGINE_ value for: SQL Server, MySQL, MariaDB, PostgreSQL and its relatives, CockroachDB, SQLite and Redis. DbGate's variables have no folders, so SQLly projects are not written. Pass the file to DbGate with docker run --env-file dbgate-connections.env dbgate/dbgate, or add the lines to the environment of your DbGate server. No PASSWORD_ lines are written; add them yourself from your secret store, or let DbGate ask by adding PASSWORD_MODE_<id>=askPassword.