Changes the default DNSWATCHER_DATA_DIR from the relative path ./data to the absolute path /var/lib/dnswatcher, following the Filesystem Hierarchy Standard convention for variable application state data.
Changes
internal/config/config.go: Changed the Viper default for DATA_DIR from "./data" to "/var/lib/"+name, where name is the application name ("dnswatcher"). This makes the default derived from the app name rather than hardcoded.
internal/config/config_test.go: Updated TestNew_DefaultValues and TestStatePath to expect the new absolute default.
README.md: Updated the environment variable table and .env example to show /var/lib/dnswatcher as the default.
The Dockerfile already set ENV DNSWATCHER_DATA_DIR=/var/lib/dnswatcher explicitly, so Docker deployments are unaffected. This change makes the code default consistent with the Docker configuration.
docker build . passes all checks (fmt, lint, tests, build).
Closes [issue #88](https://git.eeqj.de/sneak/dnswatcher/issues/88).
Changes the default `DNSWATCHER_DATA_DIR` from the relative path `./data` to the absolute path `/var/lib/dnswatcher`, following the [Filesystem Hierarchy Standard](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s08.html) convention for variable application state data.
## Changes
- **`internal/config/config.go`**: Changed the Viper default for `DATA_DIR` from `"./data"` to `"/var/lib/"+name`, where `name` is the application name ("dnswatcher"). This makes the default derived from the app name rather than hardcoded.
- **`internal/config/config_test.go`**: Updated `TestNew_DefaultValues` and `TestStatePath` to expect the new absolute default.
- **`README.md`**: Updated the environment variable table and `.env` example to show `/var/lib/dnswatcher` as the default.
The Dockerfile already set `ENV DNSWATCHER_DATA_DIR=/var/lib/dnswatcher` explicitly, so Docker deployments are unaffected. This change makes the code default consistent with the Docker configuration.
`docker build .` passes all checks (fmt, lint, tests, build).
Change the default DATA_DIR from the relative path './data' to the
absolute path '/var/lib/dnswatcher', following the FHS convention for
application state data.
The default is derived from the application name passed to setupViper,
so it will always match /var/lib/<appname>.
Updated README environment variable table and .env example to reflect
the new default. Tests updated accordingly.
✅ Met — changed from ./data to /var/lib/dnswatcher
Use /var/lib/<appname>
✅ Met — uses /var/lib/ + name where name is the app name ("dnswatcher")
Code Review
internal/config/config.go: Default changed from "./data" to "/var/lib/"+name. Correct — derives from app name rather than hardcoding, and name has a fallback to "dnswatcher" if Globals.Appname is empty.
internal/config/config_test.go: TestNew_DefaultValues and TestStatePath updated to expect /var/lib/dnswatcher. Assertions are correct and not weakened.
README.md: Environment variable table and .env example both updated to show /var/lib/dnswatcher. Consistent with code.
Dockerfile already had ENV DNSWATCHER_DATA_DIR=/var/lib/dnswatcher — Docker deployments unaffected.
Branch is already rebased on main (single commit ahead, no conflicts).
Verdict: PASS
Minimal, focused change that correctly implements the issue requirement. No policy violations, no scope creep, no cheating, docs consistent with code.
## Review: [PR #89](https://git.eeqj.de/sneak/dnswatcher/pulls/89) — config: use /var/lib/dnswatcher as default data directory
### Policy Divergences
No policy violations found.
- No new external references introduced (pinning N/A)
- No modifications to Makefile, `.golangci.yml`, CI config, or Dockerfile
- No weakened test assertions — tests updated to match new correct default
- README updated consistently with code change
- No new exported types/functions (test coverage check N/A)
### Requirements Checklist ([issue #88](https://git.eeqj.de/sneak/dnswatcher/issues/88))
| Requirement | Status |
|---|---|
| Data directory default must not be relative | ✅ Met — changed from `./data` to `/var/lib/dnswatcher` |
| Use `/var/lib/<appname>` | ✅ Met — uses `/var/lib/` + `name` where `name` is the app name ("dnswatcher") |
### Code Review
- `internal/config/config.go`: Default changed from `"./data"` to `"/var/lib/"+name`. Correct — derives from app name rather than hardcoding, and `name` has a fallback to `"dnswatcher"` if `Globals.Appname` is empty.
- `internal/config/config_test.go`: `TestNew_DefaultValues` and `TestStatePath` updated to expect `/var/lib/dnswatcher`. Assertions are correct and not weakened.
- `README.md`: Environment variable table and `.env` example both updated to show `/var/lib/dnswatcher`. Consistent with code.
- Dockerfile already had `ENV DNSWATCHER_DATA_DIR=/var/lib/dnswatcher` — Docker deployments unaffected.
### Build Result
`docker build .` — **PASS** (all cached layers, `make check` passes: fmt, lint, tests, build).
Branch is already rebased on `main` (single commit ahead, no conflicts).
### Verdict: PASS
Minimal, focused change that correctly implements the issue requirement. No policy violations, no scope creep, no cheating, docs consistent with code.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes issue #88.
Changes the default
DNSWATCHER_DATA_DIRfrom the relative path./datato the absolute path/var/lib/dnswatcher, following the Filesystem Hierarchy Standard convention for variable application state data.Changes
internal/config/config.go: Changed the Viper default forDATA_DIRfrom"./data"to"/var/lib/"+name, wherenameis the application name ("dnswatcher"). This makes the default derived from the app name rather than hardcoded.internal/config/config_test.go: UpdatedTestNew_DefaultValuesandTestStatePathto expect the new absolute default.README.md: Updated the environment variable table and.envexample to show/var/lib/dnswatcheras the default.The Dockerfile already set
ENV DNSWATCHER_DATA_DIR=/var/lib/dnswatcherexplicitly, so Docker deployments are unaffected. This change makes the code default consistent with the Docker configuration.docker build .passes all checks (fmt, lint, tests, build).Review: PR #89 — config: use /var/lib/dnswatcher as default data directory
Policy Divergences
No policy violations found.
.golangci.yml, CI config, or DockerfileRequirements Checklist (issue #88)
./datato/var/lib/dnswatcher/var/lib/<appname>/var/lib/+namewherenameis the app name ("dnswatcher")Code Review
internal/config/config.go: Default changed from"./data"to"/var/lib/"+name. Correct — derives from app name rather than hardcoding, andnamehas a fallback to"dnswatcher"ifGlobals.Appnameis empty.internal/config/config_test.go:TestNew_DefaultValuesandTestStatePathupdated to expect/var/lib/dnswatcher. Assertions are correct and not weakened.README.md: Environment variable table and.envexample both updated to show/var/lib/dnswatcher. Consistent with code.ENV DNSWATCHER_DATA_DIR=/var/lib/dnswatcher— Docker deployments unaffected.Build Result
docker build .— PASS (all cached layers,make checkpasses: fmt, lint, tests, build).Branch is already rebased on
main(single commit ahead, no conflicts).Verdict: PASS
Minimal, focused change that correctly implements the issue requirement. No policy violations, no scope creep, no cheating, docs consistent with code.