Database clients
Functions of the tools module at v0.7.0. Each returns what a command runs in; import it with import * as tools from "tools".
psql.env
psql, pg_dump and the other PostgreSQL clients.
psql.env(
--image: Environment = #postgres:18.6-alpine3.24,
--host: String | Null = null,
--port: String | Null = null,
--user: String | Null = null,
--password: String | Null = <secret>,
--database: String | Null = null,
--sslmode: String | Null = null,
--network: String | Null = null,
--base_access: String | Map<String> | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #postgres:18.6-alpine3.24 unless --image names another; use the major release of the server. lask sync pulls and pins whichever image is used (lask spec 10.3); a run never pulls.
Parameters
--imageThe image to run; another release is passed as image = #postgres:<tag>.--hostPGHOST.--portPGPORT.--userPGUSER.--password!!PGPASSWORD; masked in the command log.--databasePGDATABASE.--sslmodePGSSLMODE.--networkThe container's network: a Compose network, or "host".--base_accessWhat the container may do with the project directory: "rw" (the default), "ro", "none", or a table of paths such as {".": "ro", "dist": "rw"} (lask spec 10.2).--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "psql" } on ... or $[...].
Image postgres:18.6-alpine3.24
lask eval psql.env --host host.docker.internal --user app --database apppsql.setup
What libpq and the clients built on it read to reach a PostgreSQL server: psql and pg_dump, psycopg, node-postgres, and most others. Give it to an application's environment through --with.
psql.setup(
--host: String | Null = null,
--port: String | Null = null,
--user: String | Null = null,
--password: String | Null = <secret>,
--database: String | Null = null,
--sslmode: String | Null = null
): Record<env: Map<String>, volumes: Array<String>>Parameters
--hostPGHOST.--portPGPORT.--userPGUSER.--password!!PGPASSWORD; masked in the command log.--databasePGDATABASE.--sslmodePGSSLMODE, e.g. "require".
Returns Record<env: Map<String>, volumes: Array<String>>: The variables, for a tool's --with.
mysql.env
The MySQL client.
mysql.env(
--image: Environment = #mysql:8.4.11,
--host: String | Null = null,
--port: String | Null = null,
--user: String | Null = null,
--password: String | Null = <secret>,
--database: String | Null = null,
--network: String | Null = null,
--base_access: String | Map<String> | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #mysql:8.4.11 (an LTS release) unless --image names another. The client reads the host, the port and the password from its environment (MYSQL_HOST, MYSQL_TCP_PORT, MYSQL_PWD), but no user and no database: those go on its command line. They are set as MYSQL_USER and MYSQL_DATABASE for that, mysql -u "$MYSQL_USER" "$MYSQL_DATABASE".
Parameters
--imageThe image to run; another release is passed as image = #mysql:<tag>.--hostMYSQL_HOST.--portMYSQL_TCP_PORT.--userMYSQL_USER, for the command line.--password!!MYSQL_PWD; masked in the command log.--databaseMYSQL_DATABASE, for the command line.--networkThe container's network: a Compose network, or "host".--base_accessWhat the container may do with the project directory: "rw" (the default), "ro", "none", or a table of paths such as {".": "ro", "dist": "rw"} (lask spec 10.2).--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "mysql" } on ... or $[...].
Image mysql:8.4.11
lask eval mysql.env --host host.docker.internal --user appredis_cli.env
redis-cli.
redis_cli.env(
--image: Environment = #redis:8.10.2-alpine,
--password: String | Null = <secret>,
--network: String | Null = null,
--base_access: String | Map<String> | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #redis:8.10.2-alpine unless --image names another. redis-cli reads its password from the environment (REDISCLI_AUTH) and nothing else: the host goes on its command line, redis-cli -h host.docker.internal.
Parameters
--imageThe image to run; another release is passed as image = #redis:<tag>.--password!!REDISCLI_AUTH; masked in the command log.--networkThe container's network: a Compose network, or "host".--base_accessWhat the container may do with the project directory: "rw" (the default), "ro", "none", or a table of paths such as {".": "ro", "dist": "rw"} (lask spec 10.2).--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "redis-cli" } on ... or $[...].
Image redis:8.10.2-alpine
lask eval redis_cli.envmigrate.env
golang-migrate.
migrate.env(
--image: Environment = #migrate/migrate:v4.20.1,
--database_url: String | Null = <secret>,
--network: String | Null = null,
--base_access: String | Map<String> | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #migrate/migrate:v4.20.1 unless --image names another. migrate takes its database on the command line only, so the URL is set as DATABASE_URL for it: migrate -database "$DATABASE_URL" -path db/migrations up. The URL carries the password, and is masked whole.
Parameters
--imageThe image to run; another release is passed as image = #migrate/migrate:<tag>.--database_url!!DATABASE_URL; masked in the command log.--networkThe container's network: a Compose network, or "host".--base_accessWhat the container may do with the project directory: "rw" (the default), "ro", "none", or a table of paths such as {".": "ro", "dist": "rw"} (lask spec 10.2).--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "migrate" } on ... or $[...].
Image migrate/migrate:v4.20.1
lask eval migrate.env --database_url postgres://app:pw@host.docker.internal:5432/appflyway.env
Flyway.
flyway.env(
--image: Environment = #flyway/flyway:13.8.0-alpine,
--url: String | Null = null,
--user: String | Null = null,
--password: String | Null = <secret>,
--locations: String | Null = null,
--network: String | Null = null,
--base_access: String | Map<String> | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #flyway/flyway:13.8.0-alpine unless --image names another. Flyway reads its connection from the environment, and sends no telemetry (REDGATE_DISABLE_TELEMETRY=true).
Parameters
--imageThe image to run; another release is passed as image = #flyway/flyway:<tag>.--urlFLYWAY_URL, a JDBC URL.--userFLYWAY_USER.--password!!FLYWAY_PASSWORD; masked in the command log.--locationsFLYWAY_LOCATIONS, e.g. "filesystem:db/migration".--networkThe container's network: a Compose network, or "host".--base_accessWhat the container may do with the project directory: "rw" (the default), "ro", "none", or a table of paths such as {".": "ro", "dist": "rw"} (lask spec 10.2).--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "flyway" } on ... or $[...].
Image flyway/flyway:13.8.0-alpine
lask eval flyway.env --url jdbc:postgresql://host.docker.internal:5432/app --user app