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:
KROKI_PORT: Server port (default 8000)KROKI_ADMIN_PORT: Admin dashboard & health check port (default 8081)KROKI_HOST: Host domain used in startup banner (default localhost)KROKI_LOG_LEVEL: Default logging level (default info)KROKI_TIMEOUT: Global fallback timeout in millisecondsKROKI_MAX_INPUT_SIZE: Maximum payload size in bytesKROKI_MAX_OUTPUT_SIZE: Maximum SVG/PNG size in bytesKROKI_CONFIG: Path to a custom config fileKROKI_BROWSER_POOL_SIZE: Max concurrent browser sessions (default 4)KROKI_BROWSER_CONTEXT_TTL: Forced recycling TTL for browser contexts (default 100)
Tool-specific env overrides follow the pattern KROKI_<TOOL>_<OPTION>, e.g.:
KROKI_GRAPHVIZ_BIN: Path to dot executableKROKI_MERMAID_TIMEOUT: Timeout specifically for Mermaid routines
Capability Discovery¶
At startup, the application scans for tools in the following order:
Configuration: Paths defined in
kroki.tomlLocal Node Modules:
node_modules/.bin/(for JS tools)System Path:
PATHenvironment variable
If a tool is not found, its corresponding diagram types will be disabled.