# GotekBackend (Docker)

Backend for ESP32-S2/S3 Gotek controller.
- Stores ONLY raw floppy images in `Images/` (e.g. `Images/<id>.adf`).
- Builds a tiny FAT12 volume on-the-fly for GET, with your image + **FF.CFG from disk**.
- Accepts POSTed modified FAT, extracts the floppy image, and overwrites `Images/<id>.<ext>`.
- Requires mutual TLS (client certificate) from the ESP32.

## FF.CFG
Edit `FF.CFG` in the project root. The backend reads it at startup and serves it inside the FAT volume.
Compose mounts it into the container at `/app/FF.CFG` (read-only).

## Run with Docker Compose
```bash
CERT_PASSWORD=changeit docker compose up --build
```
This starts a `certgen` one-shot service that creates a dev CA and server cert, then runs the backend.

## Endpoints
- `GET /api/volume?id=<hex64>` -> returns a FAT12 image (your disk image + FF.CFG)
- `POST /api/volume?id=<hex64>` -> receives FAT12, extracts first non-`FF.CFG` file, saves to `Images/`

## Volumes
- `./Images`   -> /app/Images
- `./Uploaded` -> /app/Uploaded
- `./certs`    -> /certs (server.pfx + CA + client certs)
- `./FF.CFG`   -> /app/FF.CFG (read-only)

## Environment
- `CERT_PASSWORD` (required): password for `/certs/server.pfx`
