# Server Configuration

Configuration files, environment variables, and file paths.

## config.json

The server reads configuration from `/var/lib/openberth/config.json`. The installer creates this file for you.

```
{
  "domain": "openberth.example.com",
  "port": 3456,
  "dataDir": "/var/lib/openberth",
  "cloudflareProxy": false,
  "insecure": false,
  "defaultTTLHours": 72,
  "defaultMaxDeploys": 10,
  "containerDefaults": {
    "memory": "512m",
    "cpus": "0.5",
    "pidsLimit": 256,
    "diskSize": "2g",
    "networkQuota": "5g"
  }
}
```

## Configuration fields

| Field | Default | Description |
| --- | --- | --- |
| `domain` | `localhost` | Your domain name |
| `port` | `3456` | Port the server listens on (behind Caddy) |
| `dataDir` | `/var/lib/openberth` | Data directory (DB, deploys, uploads) |
| `cloudflareProxy` | `false` | Use Cloudflare proxy mode (internal TLS instead of Let’s Encrypt) |
| `insecure` | `false` | HTTP-only mode (no TLS certificates, for local/testing) |
| `defaultTTLHours` | `72` | Default deployment lifetime in hours |
| `defaultMaxDeploys` | `10` | Max deployments per user |
| `containerDefaults.memory` | `512m` | Default memory limit per container |
| `containerDefaults.cpus` | `0.5` | Default CPU limit per container |
| `containerDefaults.pidsLimit` | `256` | Max processes per container |
| `containerDefaults.diskSize` | — | Container root filesystem limit (requires overlay2+xfs+pquota) |
| `containerDefaults.networkQuota` | — | Max network transfer per container (Caddy access log based) |

## Environment variables

`DATA_DIR` — overrides the data directory. Defaults to `/var/lib/openberth`.

## File paths

| Path | Description |
| --- | --- |
| `/var/lib/openberth/config.json` | Server configuration |
| `/var/lib/AmirSoleimani/openberth.db` | SQLite database (WAL mode) |
| `/var/lib/openberth/deploys/{id}/` | Deployment source code |
| `/var/lib/openberth/persist/{id}/` | Persistent data (`/data` directory) |
| `/etc/caddy/sites/{subdomain}.caddy` | Caddy reverse proxy configs |
| `/etc/systemd/system/openberth.service` | Systemd service unit |
| `/usr/local/bin/berth-server` | Server binary |
