TOML Configuration
Configure network mode, cache settings, and disabled commands. Used for everyday bz settings.
bz supports two types of configuration:
Most users only need TOML configuration for basic settings:
[network]mode = "prefer-offline" # Use cache when available
[cache]dir = "~/.cache/bz"For registry sync workflows, use Starlark configuration in bz.star.
TOML Configuration
Configure network mode, cache settings, and disabled commands. Used for everyday bz settings.
Starlark Configuration
Define registry sync workflows with Starlark. Used for mirroring BCR to internal registries.
TOML files configure bz’s runtime behavior. Files are loaded from multiple locations with later files overriding earlier ones.
| Location | Purpose |
|---|---|
/etc/bz/config.toml | System-wide defaults |
~/.config/bz/config.toml | User preferences |
.bz.toml | Project-specific settings |
[network]mode = "prefer-offline"registry = "https://bcr.bazel.build"timeout = "30s"
[cache]dir = "~/.cache/bz"
[commands]disabled = []| Variable | Description |
|---|---|
BZ_OFFLINE | Enable offline mode |
BZ_PREFER_OFFLINE | Enable prefer-offline mode |
BZ_REGISTRY | Override registry URL |
BZ_CACHE_DIR | Override cache directory |
BZ_DISABLE_COMMANDS | Disable commands (comma-separated) |
Starlark files (bz.star) define sync workflows for mirroring modules between registries. This is an advanced feature for organizations maintaining internal registries.
bcr = registry.http("https://bcr.bazel.build")mirror = registry.file("/path/to/mirror")
sync.workflow( name = "sync-all", origin = bcr, destination = mirror, modules = ["rules_go", "rules_python"],)Run with:
bz mod sync sync-allStarlark Basics
Learn the Starlark language basics for writing configurations.
Registries
Configure source and destination registries.
Publishers
Set up different publishing backends.
Transforms
Transform modules as they sync.
All configuration is merged in this order (later overrides earlier):
/etc/bz/config.toml)~/.config/bz/config.toml).bz.toml)