Skip to content

Commit

Permalink
Update hack for resolving catalyst-api url from catalyst
Browse files Browse the repository at this point in the history
  • Loading branch information
leszko committed Aug 19, 2024
1 parent 450abaf commit 940dc0e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,11 @@ func resolveCatalystApiURL(cli config.Cli) interface{} {
// Hack to reason about the corresponding stateless catalyst-api service
// Otherwise we would need to specify CATALYST_API_CATALYST_API_URL env variable, which requires restarting
// the whole catalyst node
hostname := os.Getenv("HOSTNAME") // e.g. "staging-catalyst-0"
ecosystem := strings.Split(hostname, "-")[0] // e.g. "staging"
return fmt.Sprintf("http://%s-catalyst-api-%s:7979", ecosystem, hostname)
hostname := os.Getenv("HOSTNAME") // e.g. "staging-catalyst-0"
correspondingCatalystApiHostname := strings.Replace(hostname, "-catalyst-", "-catalyst-api-", 1) // e.g. "staging-catalyst-api-0"
return fmt.Sprintf("http://%s:7979", correspondingCatalystApiHostname)
// staging-catalyst-api-staging-catalyst-0
// staging-catalyst-api-0
}
// not used for other modes
return ""
Expand Down

0 comments on commit 940dc0e

Please sign in to comment.