Badger
Docs / API & reference

Configuration

Badger reads its configuration from /etc/badger/badger.toml. Pass --config to use another file. The file is TOML, and every option in it is optional.

Example

# /etc/badger/badger.toml
database_url = "postgres://badger@localhost/app"
queues = ["default", "mail"]
concurrency = 20
timeout = "5m"

[handler]
url = "http://127.0.0.1:8080/jobs"

[metrics]
listen = "127.0.0.1:9187"

Environment variables

Every option can also be set in the environment: write the key in upper case, replace dots with underscores and put BADGER_ in front, so retry.max_attempts becomes BADGER_RETRY_MAX_ATTEMPTS. The environment takes precedence over the file.

All options

OptionTypeDefaultDescription
database_urlstring–Connection string of the PostgreSQL database.
schemastringbadgerSchema holding the job tables.
queueslist["default"]Queues this worker takes jobs from.
concurrencyint10Jobs run at the same time per worker.
poll_intervalduration5sHow often to look for jobs when no notification arrives.
retry.max_attemptsint25Attempts before a job is marked failed.
retry.backoffduration10sWait before the first retry. Doubles with every attempt.
timeoutduration30mA job running longer is cancelled and retried.
handler.urlstring–Your application's endpoint that runs jobs.
metrics.listenstring–Address for the Prometheus metrics. Empty turns them off.
log.levelstringinfodebug, info, warn or error.