summaryrefslogtreecommitdiff
path: root/internal/config/constants.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-26 08:08:17 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-26 08:08:17 -1000
commitaff60af8ba24c8d5330c706ddf26927d81436d79 (patch)
tree60d13f58663473a3db204d8a11f2cc8f6e65445f /internal/config/constants.go
parent8c2b8c352f8c980c79bb4bb4772e8cbc02d14164 (diff)
Phase 4: Extract magic numbers to constants
Create config/constants.go with centralized configuration values: - Concurrency limits (MaxConcurrentTrelloRequests) - Timeouts (HTTP, Google Calendar, graceful shutdown, request) - Meal times (breakfast, lunch, dinner hours) - Database pool settings (connections, lifetime) - Session and rate limiting settings Update all files to use these constants instead of hardcoded values. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/config/constants.go')
-rw-r--r--internal/config/constants.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/internal/config/constants.go b/internal/config/constants.go
new file mode 100644
index 0000000..a199404
--- /dev/null
+++ b/internal/config/constants.go
@@ -0,0 +1,51 @@
+package config
+
+import "time"
+
+// Concurrency limits
+const (
+ // MaxConcurrentTrelloRequests limits parallel Trello API calls
+ MaxConcurrentTrelloRequests = 5
+)
+
+// Timeouts
+const (
+ // HTTPClientTimeout is the default timeout for HTTP clients
+ HTTPClientTimeout = 15 * time.Second
+
+ // GoogleCalendarInitTimeout is the timeout for Google Calendar initialization
+ GoogleCalendarInitTimeout = 30 * time.Second
+
+ // GracefulShutdownTimeout is the timeout for server graceful shutdown
+ GracefulShutdownTimeout = 10 * time.Second
+
+ // RequestTimeout is the timeout for individual HTTP requests
+ RequestTimeout = 60 * time.Second
+)
+
+// Default meal times (24-hour format)
+const (
+ BreakfastHour = 8
+ LunchHour = 12
+ DinnerHour = 19
+)
+
+// Database connection pool settings
+const (
+ SQLiteMaxOpenConns = 5
+ SQLiteMaxIdleConns = 2
+ SQLiteConnMaxLifetime = time.Hour
+)
+
+// Session settings
+const (
+ SessionLifetime = 24 * time.Hour
+)
+
+// Rate limiting
+const (
+ // AuthRateLimitRequests is max login attempts per window
+ AuthRateLimitRequests = 5
+ // AuthRateLimitWindow is the time window for rate limiting
+ AuthRateLimitWindow = 15 * time.Minute
+)