-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstruct_config.go
More file actions
115 lines (111 loc) · 3.33 KB
/
Copy pathstruct_config.go
File metadata and controls
115 lines (111 loc) · 3.33 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package main
import (
graphql "github.com/lukaszraczylo/go-simple-graphql"
libpack_logging "github.com/lukaszraczylo/graphql-monitoring-proxy/logging"
libpack_monitoring "github.com/lukaszraczylo/graphql-monitoring-proxy/monitoring"
"github.com/valyala/fasthttp"
)
// EndpointCBConfig holds per-endpoint circuit breaker configuration
type EndpointCBConfig struct {
MaxFailures int // Override max failures for this endpoint
FailureRatio float64 // Override failure ratio for this endpoint
Timeout int // Override timeout for this endpoint
Disabled bool // Disable circuit breaker for this endpoint
}
// config is a struct that holds the configuration of the application.
// It includes settings for logging, monitoring, client connections, security, and server behavior.
type config struct {
Logger *libpack_logging.Logger
Monitoring *libpack_monitoring.MetricsSetup
LogLevel string
EnableAllocationTracking bool
Api struct{ BannedUsersFile string }
Tracing struct {
Endpoint string
Enable bool
}
Security struct {
IntrospectionAllowed []string
BlockIntrospection bool
}
HasuraEventCleaner struct {
EventMetadataDb string
ClearOlderThan int
Enable bool
}
Cache struct {
CacheRedisURL string
CacheRedisPassword string
CacheTTL int
CacheRedisDB int
CacheEnable bool
CacheRedisEnable bool
CacheMaxMemorySize int
CacheMaxEntries int
CacheUseLRU bool // Use LRU eviction algorithm instead of random eviction
GraphQLQueryCacheSize int // Max number of parsed GraphQL queries to cache
PerUserCacheDisabled bool // Disable per-user cache isolation (SECURITY RISK - not recommended)
}
Client struct {
GQLClient *graphql.BaseClient
FastProxyClient *fasthttp.Client
JWTUserClaimPath string
JWTRoleClaimPath string
RoleFromHeader string
proxy string
ClientTimeout int
MaxConnsPerHost int
ReadTimeout int
WriteTimeout int
MaxIdleConnDuration int
RoleRateLimit bool
DisableTLSVerify bool
}
Server struct {
HostGraphQL string
HostGraphQLReadOnly string
HealthcheckGraphQL string
AllowURLs []string // List of allowed URL paths for access control
PortGraphQL int
PortMonitoring int
ApiPort int
PurgeEvery int
AccessLog bool
ReadOnlyMode bool
EnableApi bool
PurgeOnCrawl bool
}
CircuitBreaker struct {
EndpointConfigs map[string]*EndpointCBConfig // Per-endpoint circuit breaker configurations
ExcludedStatusCodes []int
MaxFailures int
FailureRatio float64
SampleSize int
Timeout int
MaxRequestsInHalfOpen int
MaxBackoffTimeout int
BackoffMultiplier float64
ReturnCachedOnOpen bool
TripOn4xx bool
TripOn5xx bool
TripOnTimeouts bool
Enable bool
}
RetryBudget struct {
TokensPerSecond float64
MaxTokens int
Enable bool
}
RequestCoalescing struct {
Enable bool
}
WebSocket struct {
Enable bool
PingInterval int // seconds
PongTimeout int // seconds
MaxMessageSize int64
}
AdminDashboard struct {
Enable bool
}
}