Configuration
anvil reads two files and three environment variables, and command-line flags beat all of them. There is a user file for your machine and a repo file for things that travel with the code. Secrets live in neither - the client refuses a token read from a repo file.
The two files
~/.config/anvil/anvil.toml is yours: the registry you usually talk to, your default channel, your token (here, not in a repo). .anvil.toml sits in a repo and carries project defaults that every checkout should share - never a token.
# ~/.config/anvil/anvil.toml registry = "https://registry.internal:8711" channel = "dev" token = "…" # only valid in the user file # .anvil.toml (committed) registry = "https://registry.internal:8711" channel = "staging" # token here is ignored, with a warning on stderr
Precedence
Highest wins. This order is the same for every key:
- command-line flag
- environment variable
- repo
.anvil.toml - user
anvil.toml - built-in default
So a --channel release on the command line overrides ANVIL_CHANNEL, which overrides the repo file, which overrides your user file. When a value surprises you, run the command with --json: the resolved registry and channel are echoed on the first line.
Keys
| Key | Default | Notes |
|---|---|---|
registry | - (required) | No default on purpose; a store you forgot to point at is worse than an error. |
channel | dev | Where a push lands if --channel is omitted. |
token | unset | User file or ANVIL_TOKEN only. |
store | ./store | Server-side; where anvil serve keeps bytes. |
listen | :8711 | Server-side listen address. |