Read the config with Viper and environment variables, on Go 1.27.4
The config loader uses Viper instead of BurntSushi/toml. Every setting can also come from UBERBRINGER_<SECTION>_<KEY>, which wins over the file, and UBERBRINGER_CONFIG sets the default of --config; set empty, no file is read, so a container can run from the environment alone. Each setting is bound to its own variable, so a variable named after a section changes nothing. The file is parsed with go-toml and checked as written: unknown keys, empty tables and keys that differ only in case are errors, a UTF-8 BOM is skipped and a UTF-16 file is refused. Values are decoded strictly: durations are strings, numbers decimal, flags true or false, and a fraction for a whole number is refused. Errors name the file, the line of a syntax error and the variables that were set, never their values. `uberbringer config get <key>` prints one setting as the daemon would use it. install.sh reads body_limit, bind_ip and port through it, so the config is checked before the service restarts and Caddy proxies to the configured address. The script then waits for the daemon to answer, downloads Caddy's key and source list before replacing them, requires Caddy's own repository, keeps the Caddyfile during dpkg upgrades, detects an existing import loosely, logs Caddy's other errors, drops query strings from the access log and validates the domain and printer address more tightly. go.mod names Go 1.27.4 with no toolchain line, and the workflows check against the go line. The changelog folds the unreleased entries into 0.2.0, which is not tagged yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
92dcacb3b9
commit
eacd0bfd27
18 files changed
+1244
-248
No files matched your search
@@ -123,6 +123,14 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
|
||||
- TypeID (UUIDv7) job and request IDs instead of snowflakes. They sort by
|
||||
time and need no node configuration.
|
||||
- An Alpine Docker image.
|
||||
- **Stack choices (owner, 2026-11-30):**
|
||||
- Viper instead of BurntSushi/toml for the config, as it goes with Cobra.
|
||||
Every key can also come from an `UBERBRINGER_<SECTION>_<KEY>` environment
|
||||
variable, which wins over the file, so a container can run without one.
|
||||
Unknown keys in the file stay errors; unknown variables are ignored,
|
||||
because the environment holds much besides Überbringer's settings.
|
||||
- `go.mod`'s go line is the latest Go release, with no separate toolchain
|
||||
line.
|
||||
- **Packaging.** The daemon serves no TLS itself and binds 127.0.0.1 by
|
||||
default; a reverse proxy in front terminates HTTPS and sets `X-Real-IP`.
|
||||
- The release tarballs are built for linux amd64, armv6, armv7 and arm64.
|
||||
@@ -133,6 +141,9 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
|
||||
certificate paths.
|
||||
- `install.sh` sets up a fresh host, and re-runs upgrade what it set up.
|
||||
It does not migrate hosts set up by the 0.1 script (owner, 2026-11-30).
|
||||
It reads the settings Caddy needs through `uberbringer config get`, so
|
||||
the daemon's own loader checks the config before the service restarts
|
||||
and no TOML is parsed in shell.
|
||||
- The Docker image is a microservice with no proxy inside: it runs behind
|
||||
the operator's own reverse proxy, whose address goes in
|
||||
`webserver.trusted_proxies`.
|
||||
|
||||
@@ -769,7 +769,7 @@ Logs
|
||||
|
||||
- Second printer, for the TM-T88VII and TM-m50II:
|
||||
- a printqueue Pool with one Queue and worker per printer
|
||||
- [printers.<name>] config decoded through toml.Primitive onto the defaults, with the old [printer] table becoming "default" and strict unknown-key checks kept
|
||||
- [printers.<name>] config, each table decoded through Viper onto the printer defaults, with the old [printer] table becoming "default" and strict unknown-key checks kept
|
||||
- ?printer= on print, preview and modules; printer = "name" per subscription; optional priority routes
|
||||
- /healthz per printer, with the status still following the default printer
|
||||
- Jobs stay printer-neutral, so nothing in the block or module code changes.
|
||||
|
||||
Reference in new issue
Block a user