Skip to content

Commit

Permalink
chore: improve vmaas-lib config
Browse files Browse the repository at this point in the history
  • Loading branch information
psegedy authored and jdobes committed Jun 5, 2023
1 parent 9028ce8 commit 6c48d2b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vmaas-go/base/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func ConfigureApp() {

func ConfigureCache() {
var err error
VmaasAPI, err = vmaas.InitFromURL(utils.Cfg.DumpAddress)
VmaasAPI, err = vmaas.InitFromURL(utils.Cfg.DumpAddress, &utils.Cfg.LibConfig)
if err != nil {
utils.LogWarn("err", err.Error(), "Cache not available on app start")
}
Expand Down
7 changes: 7 additions & 0 deletions vmaas-go/base/utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

clowder "github.com/redhatinsights/app-common-go/pkg/api/v1"
"github.com/redhatinsights/vmaas-lib/vmaas"
)

var Cfg = Config{}
Expand Down Expand Up @@ -45,6 +46,8 @@ type Config struct {
LogStyle string
CacheRefreshInterval time.Duration
EnableProfiler bool
// lib
LibConfig vmaas.Config
}

type (
Expand Down Expand Up @@ -124,6 +127,10 @@ func initEnv() {
cacheRefreshSec := GetIntEnvOrDefault("CACHE_REFRESH_INTERVAL", 60) // 1 min default
Cfg.CacheRefreshInterval = time.Second * time.Duration(cacheRefreshSec)
Cfg.EnableProfiler = GetBoolEnvOrDefault("ENABLE_PROFILER", false)
Cfg.LibConfig = vmaas.Config{
OvalUnfixedEvalEnabled: GetBoolEnvOrDefault("OVAL_UNFIXED_EVAL_ENABLED", true),
MaxGoroutines: GetIntEnvOrDefault("VMAAS_LIB_MAX_GOROUTINES", 20),
}
}

func (e *Endpoint) BuildURL(scheme string) string {
Expand Down
2 changes: 1 addition & 1 deletion vmaas-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/prometheus/client_golang v1.15.1
github.com/redhatinsights/app-common-go v1.6.6
github.com/redhatinsights/platform-go-middlewares v0.20.0
github.com/redhatinsights/vmaas-lib v0.8.1
github.com/redhatinsights/vmaas-lib v0.9.0
github.com/sirupsen/logrus v1.9.2
github.com/stretchr/testify v1.8.3
github.com/zsais/go-gin-prometheus v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions vmaas-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ github.com/redhatinsights/app-common-go v1.6.6 h1:daOwCpGtW6IxGd9iO6TY3yoaV/HaHK
github.com/redhatinsights/app-common-go v1.6.6/go.mod h1:6gzRyg8ZyejwMCksukeAhh2ZXOB3uHSmBsbP06fG2PQ=
github.com/redhatinsights/platform-go-middlewares v0.20.0 h1:qwK9ArGYRlORsZ56PXXLJrGvzTsMe3bk2lR+WN5aIjM=
github.com/redhatinsights/platform-go-middlewares v0.20.0/go.mod h1:i5gVDZJ/quCQhs5AW5CwkRPXlz1HfDBvyNtXHnlXZfM=
github.com/redhatinsights/vmaas-lib v0.8.1 h1:KwqSUw+MolBPNvvAJL9dNk6D+SAaU3ySUCIuAG1Uxag=
github.com/redhatinsights/vmaas-lib v0.8.1/go.mod h1:Hae6UhDkh9fdPtOOX0uhrol3B+wDSLSLeGFGpTBYCPA=
github.com/redhatinsights/vmaas-lib v0.9.0 h1:iU6lOaWILNfzssxnI5bQ31WRC03Qomi/nMcTzxZGpJo=
github.com/redhatinsights/vmaas-lib v0.9.0/go.mod h1:Hae6UhDkh9fdPtOOX0uhrol3B+wDSLSLeGFGpTBYCPA=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
Expand Down

0 comments on commit 6c48d2b

Please sign in to comment.