summaryrefslogtreecommitdiff
path: root/internal/config/constants.go
blob: 98c7a607ccd45c75a2c17960a58719c946cdf67f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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

	// HealthCheckTimeout bounds the DB ping /health performs. Short and
	// separate from HTTPClientTimeout: a health check that itself hangs for
	// 15s isn't fast enough for a watchdog polling every few minutes to be
	// useful.
	HealthCheckTimeout = 3 * 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 (
	// Single-user personal server -- there's no one else's session to protect by
	// forcing frequent re-logins, so this is set for "don't make me log in again,"
	// not for a shared/multi-tenant threat model.
	SessionLifetime = 365 * 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
)