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
| Option | Type | Default | Description |
|---|---|---|---|
database_url | string | – | Connection string of the PostgreSQL database. |
schema | string | badger | Schema holding the job tables. |
queues | list | ["default"] | Queues this worker takes jobs from. |
concurrency | int | 10 | Jobs run at the same time per worker. |
poll_interval | duration | 5s | How often to look for jobs when no notification arrives. |
retry.max_attempts | int | 25 | Attempts before a job is marked failed. |
retry.backoff | duration | 10s | Wait before the first retry. Doubles with every attempt. |
timeout | duration | 30m | A job running longer is cancelled and retried. |
handler.url | string | – | Your application's endpoint that runs jobs. |
metrics.listen | string | – | Address for the Prometheus metrics. Empty turns them off. |
log.level | string | info | debug, info, warn or error. |