The README didn't clearly explain what WEBHOOKER_ENVIRONMENT=dev vs prod actually changes.
The dev-mode default for DATA_DIR was ./data — a relative path whose meaning depends on the working directory. There's no reason to use a relative path even in development.
Changes
Code (internal/config/config.go)
Replace the dev default DATA_DIR from ./data to $XDG_DATA_HOME/webhooker (falling back to $HOME/.local/share/webhooker). This follows the XDG Base Directory Specification and ensures the data directory is always an absolute path regardless of the working directory.
Add devDataDir() helper that resolves the XDG path, with a /tmp/webhooker last-resort fallback if $HOME can't be determined.
Tests (internal/config/config_test.go)
TestDevDataDir: verifies XDG_DATA_HOME is respected, HOME fallback works, and the result is always absolute.
TestDevDefaultDataDirIsAbsolute: integration test that creates a full Config via fx and asserts the dev default DataDir is absolute.
README
Add a table documenting exactly what dev vs prod changes: DATA_DIR default, CORS policy, and session cookie Secure flag.
Clarify that log format and security headers are independent of the environment setting.
Update the DATA_DIR default in the configuration variable table.
Closes #45.
## Problem
1. The README didn't clearly explain what `WEBHOOKER_ENVIRONMENT=dev` vs `prod` actually changes.
2. The dev-mode default for `DATA_DIR` was `./data` — a relative path whose meaning depends on the working directory. There's no reason to use a relative path even in development.
## Changes
### Code (`internal/config/config.go`)
- Replace the dev default `DATA_DIR` from `./data` to `$XDG_DATA_HOME/webhooker` (falling back to `$HOME/.local/share/webhooker`). This follows the XDG Base Directory Specification and ensures the data directory is always an absolute path regardless of the working directory.
- Add `devDataDir()` helper that resolves the XDG path, with a `/tmp/webhooker` last-resort fallback if `$HOME` can't be determined.
### Tests (`internal/config/config_test.go`)
- `TestDevDataDir`: verifies XDG_DATA_HOME is respected, HOME fallback works, and the result is always absolute.
- `TestDevDefaultDataDirIsAbsolute`: integration test that creates a full Config via fx and asserts the dev default DataDir is absolute.
### README
- Add a table documenting exactly what `dev` vs `prod` changes: DATA_DIR default, CORS policy, and session cookie Secure flag.
- Clarify that log format and security headers are independent of the environment setting.
- Update the DATA_DIR default in the configuration variable table.
Change the dev-mode DATA_DIR default from the relative path ./data to
$XDG_DATA_HOME/webhooker (falling back to $HOME/.local/share/webhooker).
This ensures the application's data directory does not depend on the
working directory.
Add a table to the README that clearly documents what WEBHOOKER_ENVIRONMENT
actually controls: DATA_DIR default, CORS policy, and session cookie
Secure flag.
Add tests for devDataDir() and verify the dev default is always absolute.
Review: PR #46 — fix: use absolute path for dev DATA_DIR default, clarify env docs
Policy Divergences
No policy violations found.
All external references remain pinned by sha256 hash. No modifications to .golangci.yml, Makefile, Dockerfile, CI config, or test assertions. No new migration files. No secrets committed.
✅ Met — new table in README clearly lists DATA_DIR default, CORS policy, and session cookie Secure flag differences
Clarify that other settings (log format, security headers) are independent of env
✅ Met — explicit note added below the table
Replace relative ./data dev default with an absolute path
✅ Met — devDataDir() uses $XDG_DATA_HOME/webhooker → $HOME/.local/share/webhooker → /tmp/webhooker fallback chain, all absolute
Update DATA_DIR default in README config table
✅ Met — updated to $XDG_DATA_HOME/webhooker
Code Evaluation
devDataDir() — Clean XDG Base Directory Specification implementation. Three-tier fallback (XDG_DATA_HOME → HOME → /tmp) ensures an absolute path even in degenerate environments. Uses os.UserHomeDir() rather than raw $HOME which is more portable.
Tests — TestDevDataDir covers XDG override, HOME fallback, and absolute-path invariant. TestDevDefaultDataDirIsAbsolute is a full integration test through the fx DI graph verifying the end-to-end default. Both are thorough.
README — The behavior table is accurate and the config variable table is consistent with the new code.
Scope — Tightly scoped to exactly what the issue requested. No scope creep.
Build Result
docker build . passed. All tests pass (config, database, delivery, handlers, logger, middleware, session). Lint and fmt-check clean.
Verdict: PASS
PR is rebased on main (already up to date). Build verified post-rebase. Fully addresses all requirements in issue #45 with no policy violations.
## Review: [PR #46](https://git.eeqj.de/sneak/webhooker/pulls/46) — fix: use absolute path for dev DATA_DIR default, clarify env docs
### Policy Divergences
No policy violations found.
All external references remain pinned by sha256 hash. No modifications to `.golangci.yml`, Makefile, Dockerfile, CI config, or test assertions. No new migration files. No secrets committed.
### Requirements Checklist ([issue #45](https://git.eeqj.de/sneak/webhooker/issues/45))
| Requirement | Status |
|---|---|
| Document what `dev` vs `prod` actually changes | ✅ Met — new table in README clearly lists DATA_DIR default, CORS policy, and session cookie Secure flag differences |
| Clarify that other settings (log format, security headers) are independent of env | ✅ Met — explicit note added below the table |
| Replace relative `./data` dev default with an absolute path | ✅ Met — `devDataDir()` uses `$XDG_DATA_HOME/webhooker` → `$HOME/.local/share/webhooker` → `/tmp/webhooker` fallback chain, all absolute |
| Update DATA_DIR default in README config table | ✅ Met — updated to `$XDG_DATA_HOME/webhooker` |
### Code Evaluation
- **`devDataDir()`** — Clean XDG Base Directory Specification implementation. Three-tier fallback (XDG_DATA_HOME → HOME → /tmp) ensures an absolute path even in degenerate environments. Uses `os.UserHomeDir()` rather than raw `$HOME` which is more portable.
- **Tests** — `TestDevDataDir` covers XDG override, HOME fallback, and absolute-path invariant. `TestDevDefaultDataDirIsAbsolute` is a full integration test through the fx DI graph verifying the end-to-end default. Both are thorough.
- **README** — The behavior table is accurate and the config variable table is consistent with the new code.
- **Scope** — Tightly scoped to exactly what the issue requested. No scope creep.
### Build Result
`docker build .` passed. All tests pass (config, database, delivery, handlers, logger, middleware, session). Lint and fmt-check clean.
### Verdict: **PASS**
PR is rebased on `main` (already up to date). Build verified post-rebase. Fully addresses all requirements in [issue #45](https://git.eeqj.de/sneak/webhooker/issues/45) with no policy violations.
Per sneak's review: removed the separate dev/prod DATA_DIR logic entirely. Both environments now use the same default: /var/lib/webhooker.
internal/config/config.go:
Removed devDataDir() function (XDG-based path resolution)
Removed path/filepath import (no longer needed)
Replaced environment-conditional default with a single unconditional default: /var/lib/webhooker
internal/config/config_test.go:
Removed TestDevDataDir (tested the removed function)
Replaced TestDevDefaultDataDirIsAbsolute with TestDefaultDataDir — verifies the default is /var/lib/webhooker for all environment values (unset, dev, prod)
Removed unused path/filepath import
Dockerfile:
Changed data directory from /data to /var/lib/webhooker
README.md:
Removed Default DATA_DIR row from the dev/prod differences table (no longer different)
Updated DATA_DIR default in config variables table to /var/lib/webhooker
Updated Docker run example volume mount to /var/lib/webhooker
Updated all remaining references from /data to /var/lib/webhooker
## Rework Summary
Addressed review feedback on [PR #46](https://git.eeqj.de/sneak/webhooker/pulls/46) (closing [issue #45](https://git.eeqj.de/sneak/webhooker/issues/45)).
### Changes
Per sneak's review: removed the separate dev/prod DATA_DIR logic entirely. Both environments now use the same default: `/var/lib/webhooker`.
**`internal/config/config.go`:**
- Removed `devDataDir()` function (XDG-based path resolution)
- Removed `path/filepath` import (no longer needed)
- Replaced environment-conditional default with a single unconditional default: `/var/lib/webhooker`
**`internal/config/config_test.go`:**
- Removed `TestDevDataDir` (tested the removed function)
- Replaced `TestDevDefaultDataDirIsAbsolute` with `TestDefaultDataDir` — verifies the default is `/var/lib/webhooker` for all environment values (unset, dev, prod)
- Removed unused `path/filepath` import
**`Dockerfile`:**
- Changed data directory from `/data` to `/var/lib/webhooker`
**`README.md`:**
- Removed `Default DATA_DIR` row from the dev/prod differences table (no longer different)
- Updated DATA_DIR default in config variables table to `/var/lib/webhooker`
- Updated Docker run example volume mount to `/var/lib/webhooker`
- Updated all remaining references from `/data` to `/var/lib/webhooker`
### Build
`docker build .` passes — all tests pass, lint clean, fmt clean.
Review: PR #46 — fix: use absolute path for dev DATA_DIR default, clarify env docs (post-rework)
Policy Divergences
None. No modifications to .golangci.yml, Makefile, CI config, or test assertions. All external references remain pinned by sha256 hash. Only 4 files changed: Dockerfile, README.md, internal/config/config.go, internal/config/config_test.go.
Requirements Checklist
Requirement
Status
Issue #45: Document what dev vs prod actually changes
✅ New table in README lists CORS policy and session cookie Secure flag differences
sneak's rework feedback: no separate dev/prod data dir, use /var/lib/<appname>
✅ Removed devDataDir(), removed environment-conditional logic, single unconditional default /var/lib/webhooker for all environments
Rework Verification
sneak's feedback was: "there is no need for a separate dev/prod data dir - use /var/lib/<appname>"
The rework correctly:
Removed the devDataDir() function and its XDG-based path resolution
Removed the path/filepath import that was only needed for XDG logic
Replaced the if s.IsProd() { ... } else { ... } conditional with a single unconditional default: /var/lib/webhooker
Removed the "Default DATA_DIR" row from the dev/prod differences table (since there's no longer a difference)
Updated Dockerfile from /data to /var/lib/webhooker (directory creation, ownership)
Updated all README references: config variables table, Docker run example, Docker section description
No stale references to ./data or /data remain anywhere in the codebase
Code Evaluation
config.go — Clean and simple. The default is set unconditionally when DATA_DIR env var is empty. Comment explains the behavior clearly.
config_test.go — TestDefaultDataDir covers all three environment settings (unset, dev, prod) and asserts /var/lib/webhooker for each. Uses fx DI graph for realistic integration testing. No weakened assertions.
Dockerfile — Correctly creates /var/lib/webhooker and sets ownership. Comment updated.
README.md — Dev/prod behavior table is accurate (only CORS and session cookie Secure differ). Config variables table shows the correct default. Docker run example and Docker section description updated consistently.
Unaddressed Human Comments
None. sneak's only comment requested the unified data dir, which the rework fully addresses. No further human comments after the rework.
Build Result
docker build .passed. All tests pass, lint clean, fmt clean.
Verdict: PASS
The rework cleanly addresses sneak's feedback. Both dev and prod now use /var/lib/webhooker as the default DATA_DIR with no conditional logic. All references updated consistently across code, tests, Dockerfile, and README.
## Review: [PR #46](https://git.eeqj.de/sneak/webhooker/pulls/46) — fix: use absolute path for dev DATA_DIR default, clarify env docs (post-rework)
### Policy Divergences
None. No modifications to `.golangci.yml`, Makefile, CI config, or test assertions. All external references remain pinned by sha256 hash. Only 4 files changed: `Dockerfile`, `README.md`, `internal/config/config.go`, `internal/config/config_test.go`.
### Requirements Checklist
| Requirement | Status |
|---|---|
| [Issue #45](https://git.eeqj.de/sneak/webhooker/issues/45): Document what `dev` vs `prod` actually changes | ✅ New table in README lists CORS policy and session cookie Secure flag differences |
| [Issue #45](https://git.eeqj.de/sneak/webhooker/issues/45): Fix relative path for data dir | ✅ `./data` replaced with `/var/lib/webhooker` |
| sneak's rework feedback: no separate dev/prod data dir, use `/var/lib/<appname>` | ✅ Removed `devDataDir()`, removed environment-conditional logic, single unconditional default `/var/lib/webhooker` for all environments |
### Rework Verification
sneak's feedback was: *"there is no need for a separate dev/prod data dir - use `/var/lib/<appname>`"*
The rework correctly:
- Removed the `devDataDir()` function and its XDG-based path resolution
- Removed the `path/filepath` import that was only needed for XDG logic
- Replaced the `if s.IsProd() { ... } else { ... }` conditional with a single unconditional default: `/var/lib/webhooker`
- Removed the "Default DATA_DIR" row from the dev/prod differences table (since there's no longer a difference)
- Updated Dockerfile from `/data` to `/var/lib/webhooker` (directory creation, ownership)
- Updated all README references: config variables table, Docker run example, Docker section description
- No stale references to `./data` or `/data` remain anywhere in the codebase
### Code Evaluation
- **`config.go`** — Clean and simple. The default is set unconditionally when `DATA_DIR` env var is empty. Comment explains the behavior clearly.
- **`config_test.go`** — `TestDefaultDataDir` covers all three environment settings (unset, dev, prod) and asserts `/var/lib/webhooker` for each. Uses fx DI graph for realistic integration testing. No weakened assertions.
- **`Dockerfile`** — Correctly creates `/var/lib/webhooker` and sets ownership. Comment updated.
- **`README.md`** — Dev/prod behavior table is accurate (only CORS and session cookie Secure differ). Config variables table shows the correct default. Docker run example and Docker section description updated consistently.
### Unaddressed Human Comments
None. sneak's only comment requested the unified data dir, which the rework fully addresses. No further human comments after the rework.
### Build Result
`docker build .` **passed**. All tests pass, lint clean, fmt clean.
### Verdict: **PASS**
The rework cleanly addresses sneak's feedback. Both dev and prod now use `/var/lib/webhooker` as the default DATA_DIR with no conditional logic. All references updated consistently across code, tests, Dockerfile, and README.
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 #45.
Problem
WEBHOOKER_ENVIRONMENT=devvsprodactually changes.DATA_DIRwas./data— a relative path whose meaning depends on the working directory. There's no reason to use a relative path even in development.Changes
Code (
internal/config/config.go)DATA_DIRfrom./datato$XDG_DATA_HOME/webhooker(falling back to$HOME/.local/share/webhooker). This follows the XDG Base Directory Specification and ensures the data directory is always an absolute path regardless of the working directory.devDataDir()helper that resolves the XDG path, with a/tmp/webhookerlast-resort fallback if$HOMEcan't be determined.Tests (
internal/config/config_test.go)TestDevDataDir: verifies XDG_DATA_HOME is respected, HOME fallback works, and the result is always absolute.TestDevDefaultDataDirIsAbsolute: integration test that creates a full Config via fx and asserts the dev default DataDir is absolute.README
devvsprodchanges: DATA_DIR default, CORS policy, and session cookie Secure flag.Review: PR #46 — fix: use absolute path for dev DATA_DIR default, clarify env docs
Policy Divergences
No policy violations found.
All external references remain pinned by sha256 hash. No modifications to
.golangci.yml, Makefile, Dockerfile, CI config, or test assertions. No new migration files. No secrets committed.Requirements Checklist (issue #45)
devvsprodactually changes./datadev default with an absolute pathdevDataDir()uses$XDG_DATA_HOME/webhooker→$HOME/.local/share/webhooker→/tmp/webhookerfallback chain, all absolute$XDG_DATA_HOME/webhookerCode Evaluation
devDataDir()— Clean XDG Base Directory Specification implementation. Three-tier fallback (XDG_DATA_HOME → HOME → /tmp) ensures an absolute path even in degenerate environments. Usesos.UserHomeDir()rather than raw$HOMEwhich is more portable.TestDevDataDircovers XDG override, HOME fallback, and absolute-path invariant.TestDevDefaultDataDirIsAbsoluteis a full integration test through the fx DI graph verifying the end-to-end default. Both are thorough.Build Result
docker build .passed. All tests pass (config, database, delivery, handlers, logger, middleware, session). Lint and fmt-check clean.Verdict: PASS
PR is rebased on
main(already up to date). Build verified post-rebase. Fully addresses all requirements in issue #45 with no policy violations.there is no need for a separate dev/prod data dir - use
/var/lib/<appname>b1343364a3to93968b6f10Rework Summary
Addressed review feedback on PR #46 (closing issue #45).
Changes
Per sneak's review: removed the separate dev/prod DATA_DIR logic entirely. Both environments now use the same default:
/var/lib/webhooker.internal/config/config.go:devDataDir()function (XDG-based path resolution)path/filepathimport (no longer needed)/var/lib/webhookerinternal/config/config_test.go:TestDevDataDir(tested the removed function)TestDevDefaultDataDirIsAbsolutewithTestDefaultDataDir— verifies the default is/var/lib/webhookerfor all environment values (unset, dev, prod)path/filepathimportDockerfile:/datato/var/lib/webhookerREADME.md:Default DATA_DIRrow from the dev/prod differences table (no longer different)/var/lib/webhooker/var/lib/webhooker/datato/var/lib/webhookerBuild
docker build .passes — all tests pass, lint clean, fmt clean.Review: PR #46 — fix: use absolute path for dev DATA_DIR default, clarify env docs (post-rework)
Policy Divergences
None. No modifications to
.golangci.yml, Makefile, CI config, or test assertions. All external references remain pinned by sha256 hash. Only 4 files changed:Dockerfile,README.md,internal/config/config.go,internal/config/config_test.go.Requirements Checklist
devvsprodactually changes./datareplaced with/var/lib/webhooker/var/lib/<appname>devDataDir(), removed environment-conditional logic, single unconditional default/var/lib/webhookerfor all environmentsRework Verification
sneak's feedback was: "there is no need for a separate dev/prod data dir - use
/var/lib/<appname>"The rework correctly:
devDataDir()function and its XDG-based path resolutionpath/filepathimport that was only needed for XDG logicif s.IsProd() { ... } else { ... }conditional with a single unconditional default:/var/lib/webhooker/datato/var/lib/webhooker(directory creation, ownership)./dataor/dataremain anywhere in the codebaseCode Evaluation
config.go— Clean and simple. The default is set unconditionally whenDATA_DIRenv var is empty. Comment explains the behavior clearly.config_test.go—TestDefaultDataDircovers all three environment settings (unset, dev, prod) and asserts/var/lib/webhookerfor each. Uses fx DI graph for realistic integration testing. No weakened assertions.Dockerfile— Correctly creates/var/lib/webhookerand sets ownership. Comment updated.README.md— Dev/prod behavior table is accurate (only CORS and session cookie Secure differ). Config variables table shows the correct default. Docker run example and Docker section description updated consistently.Unaddressed Human Comments
None. sneak's only comment requested the unified data dir, which the rework fully addresses. No further human comments after the rework.
Build Result
docker build .passed. All tests pass, lint clean, fmt clean.Verdict: PASS
The rework cleanly addresses sneak's feedback. Both dev and prod now use
/var/lib/webhookeras the default DATA_DIR with no conditional logic. All references updated consistently across code, tests, Dockerfile, and README.