Skip to main content

Configuration

The driver reads config.json from the application root:
  • Bundled executable: next to plato-printer.exe.
  • Development: current working directory.
If config.json is missing, the driver creates one with sanitized defaults.

Example Config

{
  "server": {
    "port": 8080
  },
  "features": {
    "meshEnabled": true,
    "httpsEnabled": true
  },
  "caddy": {
    "enabled": true,
    "domain": "plato-printer.local",
    "httpsPort": 443,
    "version": "2.6.4"
  },
  "redis": {
    "mode": "embedded",
    "version": "6.2.14",
    "host": "127.0.0.1",
    "port": 6379,
    "db": 0,
    "username": "",
    "password": "",
    "diskSync": true,
    "snapshotIntervalSec": 30
  },
  "queue": {
    "retryDelayMs": 5000,
    "maxAttempts": 2147483647
  }
}

Server

FieldDefaultNotes
server.port8080HTTP port for all API endpoints.
The Express app enables permissive CORS and Access-Control-Allow-Private-Network: true so browser POS clients can call the driver from local/private networks.

Features

FieldDefaultNotes
features.meshEnabledtrueEnables PeerJS signaling on /mesh.
features.httpsEnabledtrueAllows HTTPS setup when Caddy is also enabled.
HTTPS only starts when both features.httpsEnabled and caddy.enabled are true.

Caddy

FieldDefaultNotes
caddy.enabledtrueEnables the Caddy reverse proxy path.
caddy.domainplato-printer.localHostname used for HTTPS.
caddy.httpsPort443HTTPS listener port.
caddy.version2.6.4Pinned for Windows 7 compatibility.
On Windows 7 or older, the driver rejects HTTPS configs that use a Caddy version other than 2.6.4.

Redis

FieldDefaultNotes
redis.modeembeddedembedded starts Redis from the driver; external uses an existing Redis server.
redis.version6.2.14Required embedded Redis version.
redis.host127.0.0.1Redis bind/connect host.
redis.port6379Redis port.
redis.db0Redis database number.
redis.usernameemptyUsed for external Redis auth when set.
redis.passwordemptyUsed for external Redis auth when set.
redis.diskSyncfalse generated defaultWrites Redis snapshots to dump.rdb when true. The committed production config sets this to true.
redis.snapshotIntervalSec30Snapshot interval used when disk sync is enabled.
Embedded Redis startup aborts the whole driver if Redis cannot start or if the actual Redis version does not match redis.version.

Queue

FieldDefaultNotes
queue.retryDelayMs5000Fixed retry backoff for failed print jobs.
queue.maxAttempts2147483647Maximum attempts per job. The current config effectively retries forever.

Sanitization

The config reader sanitizes values:
  • Ports and numeric settings must be positive integers.
  • Booleans can be booleans or strings "true" / "false".
  • redis.mode must be embedded or external.
  • Empty strings fall back to defaults for domain/version/host-like fields.