Skip to content

Commit

Permalink
Remove default proxy region and zone configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Djadih committed Sep 7, 2023
1 parent 3b0c380 commit 2cd648a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 0 additions & 2 deletions config/config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,10 @@
},
{
"name": "region",
"url": "ws://127.0.0.1:8579",
"timeout": "10s"
},
{
"name": "zone",
"url": "ws://127.0.0.1:8611",
"timeout": "10s"
}
],
Expand Down
16 changes: 13 additions & 3 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,17 @@ func (s *ProxyServer) connectToSlice() SliceClients {
regionErrorPrinted := false
zoneErrorPrinted := false

primeUrl := (*s.upstreams)[common.PRIME_CTX].Url
regionUrl := (*s.upstreams)[common.REGION_CTX].Url
if regionUrl == "" {
panic("Please specify region port!")
}
zoneUrl := (*s.upstreams)[common.ZONE_CTX].Url
if zoneUrl == "" {
panic("Please specify zone port!")
}

for !primeConnected || !regionConnected || !zoneConnected {
primeUrl := (*s.upstreams)[common.PRIME_CTX].Url
if primeUrl != "" && !primeConnected {
clients[common.PRIME_CTX], err = ethclient.Dial(primeUrl)
if err != nil {
Expand All @@ -192,10 +201,10 @@ func (s *ProxyServer) connectToSlice() SliceClients {
}
} else {
primeConnected = true
log.Println("Connected to Prime at: ", primeUrl)
}
}

regionUrl := (*s.upstreams)[common.REGION_CTX].Url
if regionUrl != "" && !regionConnected {
clients[common.REGION_CTX], err = ethclient.Dial(regionUrl)
if err != nil {
Expand All @@ -205,10 +214,10 @@ func (s *ProxyServer) connectToSlice() SliceClients {
}
} else {
regionConnected = true
log.Println("Connected to Region at: ", regionUrl)
}
}

zoneUrl := (*s.upstreams)[common.ZONE_CTX].Url
if zoneUrl != "" && !zoneConnected {
clients[common.ZONE_CTX], err = ethclient.Dial(zoneUrl)
if err != nil {
Expand All @@ -218,6 +227,7 @@ func (s *ProxyServer) connectToSlice() SliceClients {
}
} else {
zoneConnected = true
log.Println("Connected to Zone at: ", zoneUrl)
}
}
}
Expand Down

0 comments on commit 2cd648a

Please sign in to comment.