mise
mise (mise-en-place) is a polyglot tool manager, environment manager, and task runner. You can use it to install the varlock CLI itself, and to wire varlock into the commands you run during development.
Install varlock with mise
Section titled “Install varlock with mise”mise can install and version-manage the varlock CLI alongside the rest of your toolchain.
The github backend installs varlock’s prebuilt, self-contained binary directly from our GitHub releases. It needs no runtime (no Node or Bun) and mise verifies the download’s checksum and build attestations automatically.
[tools]"github:dmno-dev/varlock" = "latest"mise installvarlock --versionOr try it without a config file:
mise exec github:dmno-dev/varlock@latest -- varlock --versionThe npm backend installs varlock from npm. This requires a Node.js runtime — mise uses Node’s npm under the hood, so declare node in the same [tools] table (mise will not provide it automatically):
[tools]node = "lts""npm:varlock" = "latest"mise installvarlock --versionPrefer the standalone binary above when you only need the CLI — it avoids the Node dependency and starts faster.
Running your commands as tasks
Section titled “Running your commands as tasks”mise tasks are a great place to run your project’s commands. Whether you need to mention varlock in the task depends on whether the command already loads it.
When varlock is already wired into the command
Section titled “When varlock is already wired into the command”Often it is. A package.json script may already call varlock run, or your app may use a framework/runtime integration (Next.js, Vite, Astro, Node, etc.) that loads and validates env on startup. In that case the mise task just runs the command as-is — nothing varlock-specific belongs here:
[tasks.dev]run = "npm run dev" # e.g. "dev": "varlock run -- next dev", or the app uses an integrationmise run devWhen the command doesn’t load varlock on its own
Section titled “When the command doesn’t load varlock on its own”For a raw binary, a shell script, or a one-off command that isn’t already varlock-aware, wrap it with varlock run so it gets a resolved, validated environment with redacted output — scoped to that one subprocess, never your shell:
[tools]"github:dmno-dev/varlock" = "latest" # makes `varlock` available to the task
[tasks.migrate]run = "varlock run -- ./scripts/migrate.sh"
[tasks.psql]run = "varlock run -- psql"Declaring varlock in [tools] lets mise install it and put it on PATH before the task runs. If varlock is instead a dependency of your JS project, call the project-local version through your package manager and drop it from [tools] — e.g. run = "npx varlock run -- ./scripts/migrate.sh" or run = "bun run varlock run -- ./scripts/migrate.sh".
Loading env vars into your shell (advanced)
Section titled “Loading env vars into your shell (advanced)”Sometimes you genuinely want a value available to any command you type in the terminal — typically non-secret config like NODE_ENV or a public base URL. You can do this without a plugin using mise’s env._.source, which captures variables exported by a script.
Create a small script that emits varlock’s resolved env in shell format:
varlock load --format shell --compactThen source it from your config:
[env]_.source = "./.mise/load-env.sh"varlock load --format shell outputs export KEY='value' lines; --compact skips undefined optional values.
Validate when entering a project
Section titled “Validate when entering a project”If you just want a fast failure when a project’s environment is missing or invalid — without injecting anything into your shell — use a hook instead of [env]:
[hooks]enter = "varlock load > /dev/null"varlock load exits non-zero on a validation error, so you’ll see the problem as soon as you cd in. Run varlock load directly to see the full colorized error output.