Skip to content

Configuration

Configuration is read from a YAML file and from environment variables. Precedence (highest first): flags > env vars > config file > built-in defaults.

Sources

  • Config file.go-crap-tracker.yaml in the current directory or $HOME, or an explicit path via --config.
  • Environment — any key may be set with the GCTD_ prefix; . in the key becomes _ (e.g. server.portGCTD_SERVER_PORT).
  • Defaults — applied when neither file nor env var provides a value.

All keys

Key Default Env var Description
loglevel info GCTD_LOGLEVEL Log level: debug, info, warn, error
logformat json GCTD_LOGFORMAT json or text
worker_engine local GCTD_WORKER_ENGINE Scan engine name
max_stale_min 10 GCTD_MAX_STALE_MIN Reconciler: expire running tasks stale for this many minutes
queue_stale_min 2 GCTD_QUEUE_STALE_MIN Reconciler: re-publish queued tasks idle for this many minutes
crap_bin go-crap GCTD_CRAP_BIN Path or name of the go-crap binary
nats_url nats://nats.infra.svc:4222 GCTD_NATS_URL JetStream URL
nats_prefix (empty) GCTD_NATS_PREFIX Optional stream/subject prefix
dsn postgres://postgres:postgres@localhost:5432/crap_tracker?sslmode=disable GCTD_DSN Postgres DSN (single value, not split host/user/pass)
server.host (empty) GCTD_SERVER_HOST HTTP bind host
server.port 8080 GCTD_SERVER_PORT HTTP bind port
server.idletimeout (0) GCTD_SERVER_IDLETIMEOUT Server idle timeout (Go duration)
server.readtimeout (0) GCTD_SERVER_READTIMEOUT Read timeout (Go duration)
server.writetimeout (0) GCTD_SERVER_WRITETIMEOUT Write timeout (Go duration)
server.shutdowntimeout (0) GCTD_SERVER_SHUTDOWNTIMEOUT Graceful-shutdown timeout (Go duration)
cache.directory (empty → $TMPDIR/go-crap-tracker-cache) GCTD_CACHE_DIRECTORY Shared clone/coverage cache root
cache.lock_lease 5m GCTD_CACHE_LOCK_LEASE Per-repo lock lease, refreshed while work runs
cache.lock_wait 10m GCTD_CACHE_LOCK_WAIT How long a worker waits for a busy repo
cache.test_timeout 10m GCTD_CACHE_TEST_TIMEOUT Timeout for go test -coverprofile
cache.git_timeout 5m GCTD_CACHE_GIT_TIMEOUT Timeout for git operations (clone/update/reset)
cache.coverage_keep 10 GCTD_CACHE_COVERAGE_KEEP Coverage profiles kept per repo (per commit SHA)

Reconciler

max_stale_min and queue_stale_min drive the background reconciler started by serve. See Task Lifecycle.

Repo cache

The cache.* keys tune the shared clone/coverage cache and its Postgres locking. See Repo Cache.

Per-repo overrides

The global cache.test_timeout and cache.git_timeout are fallbacks. A repo may override them per-repo (via the CLI repo config set --timeout/--git-timeout or the POST /api/repo-config endpoint) when a single large repo needs more time than the rest:

go-crap-tracker repo config set https://github.com/microsoft/typescript-go --timeout 30m --git-timeout 30m

When a scan fails on a timeout, the worker logs which knob to raise (per-repo override or the corresponding global cache.* key).

Memory works the same way, but the valve is per-repo: repo config set --go-flags bounds go test parallelism for repos that OOM on constrained hardware (SBC clusters, small VPSs) while leaving every other repo at full speed. See Constrained Environments.

Example file

.go-crap-tracker.yaml:

loglevel: info
logformat: json
worker_engine: local
max_stale_min: 10
queue_stale_min: 2
crap_bin: "go-crap"
nats_url: "nats://nats.infra.svc:4222"
dsn: "postgres://gct_app:passw0rd@postgres.infra.svc:5432/crap_tracker?sslmode=disable"
server:
  host: "0.0.0.0"
  port: 8080
cache:
  directory: "/var/lib/go-crap-tracker"
  lock_lease: 5m
  lock_wait: 10m
  test_timeout: 10m
  git_timeout: 5m
  coverage_keep: 10

Example: environment only

export GCTD_NATS_URL=nats://nats.infra.svc:4222
export GCTD_DSN='postgres://gct_app:passw0rd@postgres.infra.svc:5432/crap_tracker?sslmode=disable'
export GCTD_SERVER_PORT=8080
export GCTD_WORKER_ENGINE=local
export GCTD_CACHE_DIRECTORY=/var/lib/go-crap-tracker