Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Configuration Reference

Configuration

Kroki-rs is designed to work out-of-the-box with auto-discovery, but you can customize it using a kroki.toml file in the working directory.

kroki.toml Structure

[server]
port = 8000
admin_port = 8081
host = "localhost"           # Host domain used in startup URLs
log_level = "info"           # Default logging level (debug, info, warn, error)
timeout_ms = 5000
max_input_size = 10485760   # 10MB
max_output_size = 20971520  # 20MB

[server.auth]
enabled = false             # Set to true for production
api_keys = [
  { key = "prod-key-1", label = "marketing-app" },
  { key = "debug-key", label = "internal-testing" }
]

[server.rate_limit]
enabled = false
requests_per_second = 10
burst_size = 50

[server.circuit_breaker]
enabled = false
failure_threshold = 5
reset_timeout_secs = 30

[server.metrics]
enabled = true
export_endpoint = true      # Exposes /metrics on admin port

[browser]
# Pool size for native browser engine
pool_size = 4
# Number of requests after which a browser context is recreated to prevent memory leaks.
context_ttl_requests = 100

[[plugins]]
name = "mytool"
command = "/usr/local/bin/my-renderer"
args = ["--format", "{format}", "--input", "-"]
stdin = true
formats = ["svg", "png"]

[graphviz]
bin_path = "/usr/local/bin/dot"

[mermaid]
bin_path = "./node_modules/.bin/mmdc"
config_path = "mermaid-config.json"


[d2]
bin_path = "d2"

Environment Variables

Kroki-rs configuration follows a strict priority scale: CLI Arguments > Environment Variables > kroki.toml > Defaults

You can override any configuration directly using environment variables:

Tool-specific env overrides follow the pattern KROKI_<TOOL>_<OPTION>, e.g.:

Capability Discovery

At startup, the application scans for tools in the following order:

  1. Configuration: Paths defined in kroki.toml

  2. Local Node Modules: node_modules/.bin/ (for JS tools)

  3. System Path: PATH environment variable

If a tool is not found, its corresponding diagram types will be disabled.