QR Print Station uses two configuration files with clearly separated responsibilities.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/hxmz-axfn07/qr-printing-sfw/llms.txt
Use this file to discover all available pages before exploring further.
.env (at the project root) controls infrastructure-level settings: the TCP port, database credentials, the admin secret token, and the optional print command. config.yml controls everything the customer sees: shop name and contact info, on-screen instructions, pricing rules, paper size options, and theme colors. Both files are read at startup; .env values are also re-read on each QR refresh cycle so that a PUBLIC_URL change takes effect without restarting the process.
Environment Variables
These variables are read from.env in the project root. Any variable can also be set as a real OS environment variable — OS environment takes precedence over the file.
TCP port the
ThreadingHTTPServer binds to on all interfaces (0.0.0.0). Change this if port 8000 is already in use on your machine. You will need to reflect the new port in any firewall rules or reverse-proxy configuration.Optional fully-qualified public URL (e.g. an ngrok tunnel like
https://abc.ngrok-free.app). When set, the QR code encodes this URL as its target instead of the local IP address and port. Leave blank for LAN-only deployments. The value is stripped of a trailing slash and, if it does not already end with /upload, the upload path is appended automatically.How often, in seconds, the background daemon thread re-evaluates whether the QR code PNG needs to be regenerated. The thread compares the current upload URL (derived from
PUBLIC_URL or the local IP) against the last URL written to qr-codes/.last_url. If they differ, or if qr-codes/upload.png does not exist, the PNG is regenerated. Lower values make PUBLIC_URL changes take effect faster at the cost of slightly more disk I/O.Secret token that forms the admin dashboard URL:
http://<host>:<port>/admin/<ADMIN_TOKEN>. The server returns 404 for any /admin/ path that does not match this token exactly, giving no indication that a dashboard exists. The token is also accepted for API calls as the X-Admin-Token request header or as the ?token= query parameter.Hostname or IP address of the MySQL or MariaDB server. Use
127.0.0.1 rather than localhost to ensure a TCP connection (rather than a Unix socket) when running both services on the same machine.TCP port of the MySQL server. Change this only if your database listens on a non-standard port.
MySQL user account. The bundled
server/schema.sql creates this user with GRANT ALL PRIVILEGES on the qr_printing database.Password for
MYSQL_USER. Must match the password set when the database was created. The default in server/schema.sql is change_me — update both the schema and this variable together.Name of the MySQL database. The schema file creates this database with
utf8mb4 character set and utf8mb4_unicode_ci collation.Optional shell command executed when staff trigger printing from the admin dashboard. The command is run with
subprocess.run(..., shell=True) for each document in the order. Leave blank to skip automatic printing and handle jobs manually. See PRINT_COMMAND Placeholders below for available substitution tokens.config.yml
config.yml lives at the project root and controls shop content, pricing, and UI options. All values have in-code defaults so the server starts even without the file, but customising it is essential for a real deployment.
Configuration precedence
At runtime,config.yml values are merged with in-code defaults (file wins over defaults). The settings MySQL table is then applied on top (database wins over file), allowing staff to update shop name, address, phone, file size limit, and theme accent color from the admin dashboard without touching the file. The pricing table similarly overrides config.yml pricing once rows exist in the database.
PRINT_COMMAND Placeholders
WhenPRINT_COMMAND is set, the server calls your shell command once per document when staff click Print in the admin dashboard. The following placeholders are substituted with the actual per-document values at print time:
| Placeholder | Type | Description |
|---|---|---|
{file} | string (path) | Absolute path to the uploaded file on disk, inside uploads/ |
{copies} | integer | Number of copies requested by the customer (1–99) |
{paper} | string | Paper size value from options.paper_sizes (e.g. A4, A3, Letter) |
{color} | string | Color mode key: bw or color |
{style} | string | Print style key: single or double |
lp command:
failed status and the stderr output is stored as the failure reason, visible in the admin dashboard.