> Every setting in config.json can be overridden with an environment variable. Values are applied before validation, so type coercion and defaults still apply.
> Source: https://orochibraru.com/baba/canary/docs/env · Site index: https://orochibraru.com/llms.txt

# Environment Variables

Every setting in `config.json` can be overridden with an environment variable.
Values are applied **before** validation, so type coercion and defaults still
apply.

| Variable                           | Type    | Default                        | Example                | Description                                                                                    |
| ---------------------------------- | ------- | ------------------------------ | ---------------------- | ---------------------------------------------------------------------------------------------- |
| `BABA_LOG_LEVEL`                   | string  | `info`                         | `debug`                | Log verbosity. One of: `trace`, `debug`, `info`, `warn`, `error`.                              |
| `BABA_MACHINE_NAME`                | string  | `(system hostname)`            | `nas-01`               | Display name for this machine, prepended to every alert message.                               |
| `BABA_INTERVAL_SECONDS`            | number  | `60`                           | `30`                   | Seconds between monitor check cycles.                                                          |
| `BABA_REMINDER_INTERVAL_MINUTES`   | number  | `30`                           | `60`                   | Minutes before re-alerting for an ongoing incident.                                            |
| `BABA_DATABASE_PATH`               | string  | `/var/lib/baba/incidents.json` | `/data/incidents.json` | Path to the JSON incident history.                                                             |
| `BABA_CPU_ENABLED`                 | boolean | `true`                         | —                      | Enable CPU usage monitoring.                                                                   |
| `BABA_CPU_THRESHOLD`               | number  | `90`                           | `80`                   | CPU usage % that triggers an alert.                                                            |
| `BABA_CPU_CONSECUTIVE_BREACHES`    | number  | `3`                            | —                      | Consecutive high readings before opening a CPU incident.                                       |
| `BABA_LOAD_ENABLED`                | boolean | `true`                         | —                      | Enable system load-average monitoring.                                                         |
| `BABA_LOAD_THRESHOLD`              | number  | `8`                            | `4`                    | 1-minute load average that triggers an alert. Rule of thumb: number of CPU cores.              |
| `BABA_LOAD_CONSECUTIVE_BREACHES`   | number  | `3`                            | —                      | Consecutive high readings before opening a load incident.                                      |
| `BABA_MEMORY_ENABLED`              | boolean | `true`                         | —                      | Enable memory usage monitoring.                                                                |
| `BABA_MEMORY_THRESHOLD`            | number  | `90`                           | `85`                   | Memory usage % that triggers an alert.                                                         |
| `BABA_MEMORY_CONSECUTIVE_BREACHES` | number  | `3`                            | —                      | Consecutive high readings before opening a memory incident.                                    |
| `BABA_DISK_ENABLED`                | boolean | `true`                         | —                      | Enable disk usage monitoring.                                                                  |
| `BABA_DISK_THRESHOLD`              | number  | `90`                           | `85`                   | Disk usage % that triggers an alert.                                                           |
| `BABA_DISK_VOLUMES`                | csv     | `/`                            | `/,/data`              | Comma-separated mount points to monitor.                                                       |
| `BABA_TEMP_ENABLED`                | boolean | `false`                        | —                      | Enable temperature monitoring (CPU + all GPUs). Off by default; most values are null on macOS. |
| `BABA_TEMP_CPU_THRESHOLD`          | number  | `85`                           | `80`                   | CPU temperature (°C) that triggers an alert.                                                   |
| `BABA_TEMP_GPU_THRESHOLD`          | number  | `85`                           | `80`                   | GPU temperature (°C) that triggers an alert.                                                   |
| `BABA_TEMP_CONSECUTIVE_BREACHES`   | number  | `3`                            | —                      | Consecutive high readings before opening a temperature incident.                               |
| `BABA_GPU_ENABLED`                 | boolean | `false`                        | —                      | Enable GPU utilization monitoring. Off by default; metrics unavailable on macOS.               |
| `BABA_GPU_THRESHOLD`               | number  | `90`                           | `85`                   | GPU utilization % that triggers an alert.                                                      |
| `BABA_GPU_CONSECUTIVE_BREACHES`    | number  | `3`                            | —                      | Consecutive high readings before opening a GPU incident.                                       |
| `BABA_UPDATES_NOTIFY_ENABLED`      | boolean | `true`                         | —                      | Send an alert via your configured notifiers when a newer release is available.                 |

## Notifiers

Configure notifiers with individual environment variables — no JSON required.
Each notifier type is independent; set whichever you need.

### Discord

| Variable                             | Description                                                              | Example                                         |
| ------------------------------------ | ------------------------------------------------------------------------ | ----------------------------------------------- |
| `BABA_NOTIFIERS_DISCORD_WEBHOOK_URL` | Webhook URL. When set, replaces any Discord notifier from `config.json`. | `https://discord.com/api/webhooks/<id>/<token>` |

```bash
BABA_NOTIFIERS_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/<id>/<token>
```

### Telegram

Both variables must be set together.

| Variable                            | Description                                                   | Example                                         |
| ----------------------------------- | ------------------------------------------------------------- | ----------------------------------------------- |
| `BABA_NOTIFIERS_TELEGRAM_BOT_TOKEN` | Token from @BotFather on Telegram.                            | `123456789:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
| `BABA_NOTIFIERS_TELEGRAM_CHAT_ID`   | Target chat, group ID (prefixed with `-`), or `@channelname`. | `-1001234567890`                                |

```bash
BABA_NOTIFIERS_TELEGRAM_BOT_TOKEN=123456789:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BABA_NOTIFIERS_TELEGRAM_CHAT_ID=-1001234567890
```

### Both notifiers at the same time

```bash
BABA_NOTIFIERS_DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/<id>/<token>"
BABA_NOTIFIERS_TELEGRAM_BOT_TOKEN="123456789:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
BABA_NOTIFIERS_TELEGRAM_CHAT_ID="-1001234567890"
```

Env var notifiers override any notifier of the same type from `config.json`
while leaving other types in place. If only one of the Telegram pair is set,
both are ignored with a warning.

## Types

| Type      | Parsing                                                           |
| --------- | ----------------------------------------------------------------- |
| `string`  | Passed through as-is                                              |
| `number`  | A decimal number; the `*_CONSECUTIVE_BREACHES` ones must be whole |
| `boolean` | `"true"` or `"1"` is `true`; anything else is `false`             |
| `csv`     | Split on `,`, trimmed, empty entries removed                      |

An unset or empty variable leaves the config value alone. A number that doesn't
parse stops baba with `invalid value for BABA_…`, instead of silently falling
back.

## Config file location

`BABA_CONFIG_PATH` sets where every command reads `config.json` when `--config`
isn't given; the default is `/var/lib/baba/config.json`. The Docker image sets
it to `/app/config.json`.
