# Server configuration

config/server.toml defines the gateway listener, features, logging, devices, scan groups, databases, authentication, and topology. Node settings and notifications use additional files.

## A server.toml with devices and history.

```toml
# config/server.toml
[server]
name = "plant-a"
bind_address = "0.0.0.0"
http_port = 8400

[features]
historian = true
hmi_serving = true

[logging]
level = "info"
format = "pretty"

[logging.file]
enabled = true
rotation = "daily"

[[scan_groups]]
name = "fast"
rate_ms = 100

[[scan_groups]]
name = "normal"
rate_ms = 250

[[devices]]
name = "s7-plc"
driver = "s7"
[devices.config]
host = "192.168.0.1"
rack = 0
slot = 1
poll_rate_ms = 500

[[databases]]
name = "historian"
driver = "postgresql"
[databases.config]
host = "localhost"
database = "thermite"
username = "thermite"
password_env = "THERMITE_DB_PASSWORD"
```

## Identity and listener.

| Field | Default | Description |
| --- | --- | --- |
| `name` | `required` | Server instance name — shows in the admin dashboard and logs. |
| `profile` | `"standard"` | Gateway profile: "standard", "edge", "hub", "dmz-broker", or "arbiter". Accepted under the legacy key "role" too. Non-standard profiles are part of multi-gateway topologies (Commercial). |
| `bind_address` | `"0.0.0.0"` | HTTP bind address. |
| `http_port` | `8400` | HTTP port for the admin UI, project mounts, and APIs. |

## Subsystem switches.

| Field | Default | Description |
| --- | --- | --- |
| `historian` | `true` | Record tag history to PostgreSQL. Requires a \[\[databases\]\] entry. |
| `hmi_serving` | `false` | Serve HMI screens, thermite.js, and thermite.css. |
| `transactions` | `true` | Run transaction groups and named queries. |
| `admin_dashboard` | `true` | Serve the admin dashboard and its APIs on the gateway port. |

## Console and file logging.

file.\* keys live in a \[logging.file\] sub-table.

| Field | Default | Description |
| --- | --- | --- |
| `level` | `"info"` | "trace", "debug", "info", "warn", "error". |
| `format` | `"pretty"` | "pretty" for humans, "json" for log shippers. |
| `buffer_size` | `2000` | In-memory log buffer size (feeds the admin dashboard's log view). |
| `file.enabled` | `true` | Also write logs to the site's logs/ directory. |
| `file.directory` | `"logs"` | Log directory, relative to the site root. |
| `file.rotation` | `"daily"` | "daily", "hourly", or "never". |

## Named polling intervals for OPC UA tags.

OPC UA tags select an interval with scan_group = `"<name>"`. S7, CIP, Modbus, and BACnet use the device's poll_rate_ms; the simulator uses update_rate_ms.

| Field | Default | Description |
| --- | --- | --- |
| `name` | `required` | Group name referenced by tags' scan_group field. |
| `rate_ms` | `required` | Poll interval in milliseconds. Minimum 10. |
| `enabled` | `true` | Disabled groups are ignored; their OPC UA tags use the device's default polling interval. |

## PostgreSQL connections.

config.\* keys live in a \[databases.config\] sub-table. An unbound historian needs one eligible PostgreSQL connection to bind; it does not choose between multiple candidates.

| Field | Default | Description |
| --- | --- | --- |
| `name` | `required` | Reference name — transaction groups and queries select databases by it. |
| `driver` | `required` | Use "postgresql". |
| `enabled` | `true` | Allow this connection to be used by the historian, transaction groups, and named queries. |
| `config.host` | `"localhost"` | Database hostname. |
| `config.port` | `5432` | Database port. |
| `config.database` | `"thermite"` | Database name. |
| `config.username` | `"thermite"` | Database user. |
| `config.password` | `—` | Plaintext password. Prefer password_env. |
| `config.password_env` | `—` | Name of an environment variable holding the password. |
| `config.max_connections` | `5` | Connection pool size (1–200). |

## Config that lives on other pages.

### [`[[devices]]`](https://thermitescada.com/docs/device-configuration.md)

Per-driver connection settings for all seven drivers.

### [`[auth]`](https://thermitescada.com/docs/security.md)

Gateway users, sessions, and project-level roles.

### `[mesh] · [[peers]] · [redundancy]`

Multi-gateway topologies — redundant pairs, hub-and-edge — are Commercial features configured with your deployment engineer.
