Skip to content

Configuration

carmy::app() reads carmy.toml from the working directory, then applies environment variables. The precedence is environment, then file, then defaults.

key env var default
name CARMY_NAME carmy
address CARMY_ADDR 127.0.0.1:3000
timeout_secs CARMY_TIMEOUT_SECS 30

CARMY_CONFIG=path/to/file.toml reads another file. Unknown keys are errors, so typos don’t go unnoticed:

invalid configuration: carmy.toml: unknown field `adress`, expected one of `name`, `address`, `timeout_secs`

run() chooses what to do from the first command-line argument:

command effect
(none) or server serve HTTP on address
mcp serve MCP over stdin/stdout
tools print the tool catalog as JSON and exit

Everything in the file can also be set in code, and code wins:

carmy::app()
.name("shop")
.address("0.0.0.0:8080")
.timeout(std::time::Duration::from_secs(10))
.state(db)
.policy(RequireToolPermission)
.run()
.await

Carmy::new() ignores the file, the environment and auto-registration entirely.

feature default provides
http yes carmy::http, .router(), .listen()
mcp yes carmy::mcp, .serve_mcp_stdio()
observability yes the tracing subscriber installed by run()
carmy = { version = "0.1", default-features = false, features = ["http"] }