feat(config): add standalone configuration section #652

Merged
fuzzy merged 1 commit from feat/standalone-config into main 2026-08-13 14:45:12 +00:00
Owner

What

Add the standalone-specific configuration section, completing Phase 1 of the Docker roadmap.

  • Standalone config section (#338) — new config.StandaloneConfig on config.Config (standalone.* in YAML/TOML, THWAP_PAGESD_STANDALONE_* env).
  • Socket path override (#339)standalone.socket_path (default /var/run/docker.sock); wired into newDeployer so standalone mode connects to the configured socket.
  • Base directory override (#340)standalone.base_dir (default /var/lib/thwap-pagesd), the site-storage root per the deployment model.
  • Network mode (#341)standalone.network_mode (bridge default, host, custom), validated at config load. Custom network names arrive with Phase 3 (#376).
  • Port range (#342)standalone.port_range, a "min-max" host-port range for site containers, parsed when port allocation lands (Phase 3 #369).

Why

Phase 1 of the Docker roadmap needs standalone runtime knobs before container lifecycle (Phase 2) and port/networking (Phase 3) build on them. This is the config surface; only the socket path has a runtime consumer today.

Testing

  • internal/config — default assertions for all standalone fields
  • YAML/TOML fixtures extended with a standalone section; want structs updated
  • Env-var override test (THWAP_PAGESD_STANDALONE_*)
  • network_mode validation (bridge/host/custom accepted, others rejected)
  • go vet ./... clean
  • go test -race -count=1 ./... full suite, no failures
  • Pre-commit hooks pass (golangci-lint, go fmt, go mod tidy, go test, gitleaks, YAML/TOML checks)

Breaking Changes

None. New optional config section; defaults preserve existing behavior.

Notes

base_dir, network_mode, and port_range have no runtime consumer yet — they are consumed by Phase 2/3 (container creation #349, networking #378, port allocation #369).

Closes #338
Closes #339
Closes #340
Closes #341
Closes #342
Closes #343

## What Add the standalone-specific configuration section, completing Phase 1 of the Docker roadmap. - **Standalone config section (#338)** — new `config.StandaloneConfig` on `config.Config` (`standalone.*` in YAML/TOML, `THWAP_PAGESD_STANDALONE_*` env). - **Socket path override (#339)** — `standalone.socket_path` (default `/var/run/docker.sock`); wired into `newDeployer` so standalone mode connects to the configured socket. - **Base directory override (#340)** — `standalone.base_dir` (default `/var/lib/thwap-pagesd`), the site-storage root per the deployment model. - **Network mode (#341)** — `standalone.network_mode` (`bridge` default, `host`, `custom`), validated at config load. Custom network names arrive with Phase 3 (#376). - **Port range (#342)** — `standalone.port_range`, a `"min-max"` host-port range for site containers, parsed when port allocation lands (Phase 3 #369). ## Why Phase 1 of the Docker roadmap needs standalone runtime knobs before container lifecycle (Phase 2) and port/networking (Phase 3) build on them. This is the config surface; only the socket path has a runtime consumer today. ## Testing - [x] `internal/config` — default assertions for all standalone fields - [x] YAML/TOML fixtures extended with a `standalone` section; `want` structs updated - [x] Env-var override test (`THWAP_PAGESD_STANDALONE_*`) - [x] `network_mode` validation (bridge/host/custom accepted, others rejected) - [x] `go vet ./...` clean - [x] `go test -race -count=1 ./...` full suite, no failures - [x] Pre-commit hooks pass (golangci-lint, go fmt, go mod tidy, go test, gitleaks, YAML/TOML checks) ## Breaking Changes None. New optional config section; defaults preserve existing behavior. ## Notes `base_dir`, `network_mode`, and `port_range` have no runtime consumer yet — they are consumed by Phase 2/3 (container creation #349, networking #378, port allocation #369). Closes #338 Closes #339 Closes #340 Closes #341 Closes #342 Closes #343
feat(config): add standalone configuration section
Some checks failed
CI / build (pull_request) Successful in 3m49s
CI / docker (pull_request) Successful in 3m10s
CI / test (pull_request) Successful in 12m34s
CI / lint (pull_request) Successful in 8m20s
CI / docker (push) Failing after 1m13s
CI / build (push) Successful in 5m48s
CI / test (push) Successful in 5m52s
CI / lint (push) Successful in 11m1s
7a582a925e
Add a standalone (Docker) config section with socket path, site storage
base directory, network mode, and host port range settings.

- config: add StandaloneConfig with socket_path (default
  /var/run/docker.sock), base_dir (default /var/lib/thwap-pagesd),
  network_mode (bridge/host/custom, default bridge), and port_range
  (min-max string); validate network mode on load; env vars via the
  existing THWAP_PAGESD_ prefix
- main: pass cfg.Standalone.SocketPath into the standalone docker client
- tests: defaults, YAML/TOML fixtures, env overrides, network-mode
  validation
- DOCKER-ROADMAP.md: mark #343 and subtasks complete

Closes #338
Closes #339
Closes #340
Closes #341
Closes #342
Closes #343
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-08-13 14:29:49 +00:00
the.auditor left a comment

Clean, focused config PR completing Phase 1. Defaults match the deployment model, env mapping (THWAP_PAGESD_STANDALONE_*) is consistent with the existing viper prefix+replacer scheme, network_mode is validated at load, and the socket path is wired into newDeployer. Tests cover defaults, YAML/TOML fixtures, env overrides, and validation. Referenced issues #338–#343 are all closed and the roadmap checkboxes match; the Phase 1 milestone is now fully complete.

Suggestions

  1. internal/config/config.goport_range declares "min-max" semantics but validate() only constrains network_mode; malformed ranges load silently until Phase 3 parses them. Consider validating format/bounds at load. Filed as #653.
  2. cmd/thwap-pagesd/main.godocker.NewClient(cfg.Standalone.SocketPath) always builds unix://+path, so a relative socket_path breaks; the unused docker.AbsSocketPath helper can resolve it. Filed as #654.

No blocking issues. Approving.

Clean, focused config PR completing Phase 1. Defaults match the deployment model, env mapping (`THWAP_PAGESD_STANDALONE_*`) is consistent with the existing viper prefix+replacer scheme, `network_mode` is validated at load, and the socket path is wired into `newDeployer`. Tests cover defaults, YAML/TOML fixtures, env overrides, and validation. Referenced issues #338–#343 are all closed and the roadmap checkboxes match; the Phase 1 milestone is now fully complete. ## Suggestions 1. `internal/config/config.go` — `port_range` declares `"min-max"` semantics but `validate()` only constrains `network_mode`; malformed ranges load silently until Phase 3 parses them. Consider validating format/bounds at load. Filed as #653. 2. `cmd/thwap-pagesd/main.go` — `docker.NewClient(cfg.Standalone.SocketPath)` always builds `unix://`+path, so a relative `socket_path` breaks; the unused `docker.AbsSocketPath` helper can resolve it. Filed as #654. No blocking issues. Approving.
fuzzy merged commit 7a582a925e into main 2026-08-13 14:45:12 +00:00
fuzzy deleted branch feat/standalone-config 2026-08-13 14:45:13 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/thwap-pagesd!652
No description provided.