Skip to content

Commit

Permalink
RHINENG-3742: update app-common-go
Browse files Browse the repository at this point in the history
  • Loading branch information
psegedy committed Nov 20, 2023
1 parent df097f8 commit 6cb616b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
21 changes: 17 additions & 4 deletions base/utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ func initKafkaFromClowder() {
}

type Endpoint clowder.DependencyEndpoint
type PrivateEndpoint clowder.PrivateDependencyEndpoint

func initServicesFromClowder() {
webappName := "webapp-service"
Expand All @@ -238,13 +239,13 @@ func initServicesFromClowder() {
if e.App == "patchman" {
switch e.Name {
case "manager":
Cfg.ManagerPrivateAddress = (*Endpoint)(&e).buildURL()
Cfg.ManagerPrivateAddress = (*PrivateEndpoint)(&e).buildURL()
case "listener":
Cfg.ListenerPrivateAddress = (*Endpoint)(&e).buildURL()
Cfg.ListenerPrivateAddress = (*PrivateEndpoint)(&e).buildURL()
case "evaluator-upload":
Cfg.EvaluatorUploadPrivateAddress = (*Endpoint)(&e).buildURL()
Cfg.EvaluatorUploadPrivateAddress = (*PrivateEndpoint)(&e).buildURL()
case "evaluator-recalc":
Cfg.EvaluatorRecalcPrivateAddress = (*Endpoint)(&e).buildURL()
Cfg.EvaluatorRecalcPrivateAddress = (*PrivateEndpoint)(&e).buildURL()
}
}
}
Expand All @@ -262,6 +263,18 @@ func (e *Endpoint) buildURL() string {
return fmt.Sprintf("%s://%s:%d", scheme, e.Hostname, port)
}

func (e *PrivateEndpoint) buildURL() string {
port := e.Port
scheme := "http"
if clowder.LoadedConfig.TlsCAPath != nil {
scheme += "s"
if e.TlsPort != nil {
port = *e.TlsPort
}
}
return fmt.Sprintf("%s://%s:%d", scheme, e.Hostname, port)
}

func initCloudwatchFromClowder() {
cwCfg := clowder.LoadedConfig.Logging.Cloudwatch
if cwCfg != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/client_golang v1.15.1
github.com/redhatinsights/app-common-go v1.6.6
github.com/redhatinsights/app-common-go v1.6.7
github.com/redhatinsights/identity v0.0.0-20220719174832-36a7b1cbeff1
github.com/redhatinsights/platform-go-middlewares v0.20.0
github.com/segmentio/kafka-go v0.4.40
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdO
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg=
github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
github.com/redhatinsights/app-common-go v1.6.6 h1:daOwCpGtW6IxGd9iO6TY3yoaV/HaHKjo/j/05dV0hHM=
github.com/redhatinsights/app-common-go v1.6.6/go.mod h1:6gzRyg8ZyejwMCksukeAhh2ZXOB3uHSmBsbP06fG2PQ=
github.com/redhatinsights/app-common-go v1.6.7 h1:cXWW0F6ZW53RLRr54gn7Azo9CLTysYOmFDR0D0Qd0Fs=
github.com/redhatinsights/app-common-go v1.6.7/go.mod h1:6gzRyg8ZyejwMCksukeAhh2ZXOB3uHSmBsbP06fG2PQ=
github.com/redhatinsights/identity v0.0.0-20220719174832-36a7b1cbeff1 h1:oCJ53EClFw5LdNWLKYmwGeqkUoYLV0Wy6ZaZlwjDYDY=
github.com/redhatinsights/identity v0.0.0-20220719174832-36a7b1cbeff1/go.mod h1:B0Dwuuaghxyqo8ltmLZyLpKQFKU6r8cE2YRrO0bVdXM=
github.com/redhatinsights/platform-go-middlewares v0.20.0 h1:qwK9ArGYRlORsZ56PXXLJrGvzTsMe3bk2lR+WN5aIjM=
Expand Down

0 comments on commit 6cb616b

Please sign in to comment.