config: use /var/lib/dnswatcher as default data directory #89
Reference in New Issue
Block a user
Delete Branch "fix/88-absolute-datadir"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.