# Example levcs-instance config.
#
# Copy to /etc/levcs/instance.toml on the VPS and edit. The systemd
# unit at deploy/levcs-instance.service expects this exact path.
#
# CLI flags (--root, --bind) override the matching fields below. The
# instance only loads a config file when --config is passed; the
# systemd unit passes --config /etc/levcs/instance.toml.

# Where repositories live on disk. Each repo is a subdirectory keyed
# by its repo_id (BLAKE3-of-genesis-authority hex). The systemd unit
# expects a `levcs` user that owns this path.
root = "/var/lib/levcs"

# Local listen address. Keep this on loopback when running behind a
# reverse proxy — the proxy terminates TLS and forwards plaintext HTTP
# here. Use `0.0.0.0:7117` only if you intentionally want to expose
# the bare HTTP API (e.g. dev environments behind a private network).
bind = "127.0.0.1:7117"

# §4.3 storage mode. "full" stores every reachable object — the right
# choice for an authoritative source-of-truth instance. Use "release"
# or "metadata" only on read replicas that mirror from another instance.
storage_mode = "full"

# §6.6.4 merge handler policy. Pushes whose merge-records reference a
# handler not in this list are rejected. The instance always allows
# the built-in handler set when "builtin" appears here. Add specific
# tree-sitter or plugin handler names to admit them.
allowed_handlers = ["builtin"]

# Other instances this one knows about. Currently informational —
# advertised on /levcs/v1/instance/peers but not used for cross-instance
# fetching. Leave empty unless you're publishing a federation directory.
federation_peers = []

# Per-repository mirror declarations (§5.6). Each block sets up a
# read-only mirror of a repo hosted on another instance. The background
# poller pulls from `source` every `poll_interval` and serves the
# replicated state to local clients. Pushes to mirrored repos are
# rejected with 403 unless `writeback = true`.
#
# Uncomment to mirror a repo:
#
# [[mirrors]]
# repo_id = "abcd1234..."                       # 64-hex repo_id
# source = "https://other.example/levcs/v1"
# mode = "full"                                 # full | release
# poll_interval = "5m"                          # 30s | 5m | 1h | <seconds>
# writeback = false
