chore: consolidate DBURL into DATA_DIR, codebase audit for 1.0.0
All checks were successful
check / check (push) Successful in 56s
All checks were successful
check / check (push) Successful in 56s
DBURL → DATA_DIR consolidation:
- Remove DBURL env var entirely; main DB now lives at {DATA_DIR}/webhooker.db
- database.go constructs DB path from config.DataDir, ensures dir exists
- Update DATA_DIR prod default from /data/events to /data
- Update all tests to use DataDir instead of DBURL
- Update Dockerfile: /data (not /data/events) for all SQLite databases
- Update README configuration table, Docker examples, architecture docs
Dead code removal:
- Remove unused IndexResponse struct (handlers/index.go)
- Remove unused TemplateData struct (handlers/handlers.go)
Stale comment cleanup:
- Remove TODO in server.go (DB cleanup handled by fx lifecycle)
- Fix nolint:golint → nolint:revive on ServerParams for consistency
- Clean up verbose middleware/routing comments in routes.go
- Fix TODO fan-out description (worker pool, not goroutine-per-target)
.gitignore fixes:
- Add data/ directory to gitignore
- Remove stale config.yaml entry (env-only config since rework)
This commit is contained in:
@@ -99,14 +99,6 @@ func (s *Handlers) decodeJSON(w http.ResponseWriter, r *http.Request, v interfac
|
||||
return json.NewDecoder(r.Body).Decode(v)
|
||||
}
|
||||
|
||||
// TemplateData represents the common data passed to templates
|
||||
type TemplateData struct {
|
||||
User *UserInfo
|
||||
Version string
|
||||
UserCount int64
|
||||
Uptime string
|
||||
}
|
||||
|
||||
// UserInfo represents user information for templates
|
||||
type UserInfo struct {
|
||||
ID string
|
||||
|
||||
@@ -34,7 +34,6 @@ func TestHandleIndex(t *testing.T) {
|
||||
logger.New,
|
||||
func() *config.Config {
|
||||
return &config.Config{
|
||||
DBURL: "file:" + t.TempDir() + "/test.db?cache=shared&mode=rwc",
|
||||
DataDir: t.TempDir(),
|
||||
}
|
||||
},
|
||||
@@ -66,7 +65,6 @@ func TestRenderTemplate(t *testing.T) {
|
||||
logger.New,
|
||||
func() *config.Config {
|
||||
return &config.Config{
|
||||
DBURL: "file:" + t.TempDir() + "/test.db?cache=shared&mode=rwc",
|
||||
DataDir: t.TempDir(),
|
||||
}
|
||||
},
|
||||
|
||||
@@ -8,11 +8,6 @@ import (
|
||||
"sneak.berlin/go/webhooker/internal/database"
|
||||
)
|
||||
|
||||
type IndexResponse struct {
|
||||
Message string `json:"message"`
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
func (s *Handlers) HandleIndex() http.HandlerFunc {
|
||||
// Calculate server start time
|
||||
startTime := time.Now()
|
||||
|
||||
Reference in New Issue
Block a user