Skip to content

Commit

Permalink
fix nil deref
Browse files Browse the repository at this point in the history
  • Loading branch information
bubbajoe committed May 5, 2024
1 parent e97dee0 commit ddfd796
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/proxy/proxy_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ func NewProxyState(conf *config.DGateConfig) *ProxyState {
WithComponentLogger("proxy_store"),
WithDefaultLevel(zerolog.InfoLevel),
)
replicationEnabled := false
if conf.AdminConfig != nil && conf.AdminConfig.Replication != nil {
replicationEnabled = true

Check warning on line 133 in internal/proxy/proxy_state.go

View check run for this annotation

Codecov / codecov/patch

internal/proxy/proxy_state.go#L133

Added line #L133 was not covered by tests
}
state := &ProxyState{
version: "unknown",
startTime: time.Now(),
Expand All @@ -145,7 +149,7 @@ func NewProxyState(conf *config.DGateConfig) *ProxyState {
proxyLock: new(sync.RWMutex),
sharedCache: cache.New(),
store: proxy_store.New(dataStore, storeLogger),
replicationEnabled: conf.AdminConfig.Replication != nil,
replicationEnabled: replicationEnabled,
ReverseProxyBuilder: reverse_proxy.NewBuilder().
FlushInterval(-1).
ErrorLogger(log.New(rpLogger, "", 0)).
Expand Down

0 comments on commit ddfd796

Please sign in to comment.