Skip to content

Commit

Permalink
Change empty config check
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelreiswildlife committed Sep 26, 2023
1 parent c6882f3 commit 2720b21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions api/app.go
Expand Up @@ -220,11 +220,15 @@ func (app *App) loadConfiguration() error {

func (app *App) configureEnrichment() {
// If a specific Redis instance is not provided, use the same one as the rest of the service.
if app.ParsedConfig.Enrichment.Cache == nil {
if app.ParsedConfig.Enrichment.Cache.Addr == "" {
host := app.Config.GetString("redis.host")
port := app.Config.GetInt("redis.port")
password := app.Config.GetString("redis.password")

app.ParsedConfig.Enrichment.Cache = &config.Cache{Addr: fmt.Sprintf("%s:%d", host, port)}
app.ParsedConfig.Enrichment.Cache = &config.Cache{
Addr: fmt.Sprintf("%s:%d", host, port),
Password: password,
}
}

redisClient := redis.NewClient(&redis.Options{
Expand Down
2 changes: 1 addition & 1 deletion config/default.yaml
Expand Up @@ -38,7 +38,7 @@ enrichment:
cache:
disabled: false
ttl: 24h
addrs: "localhost:6739"
addrs: ""
username: ""
webhook_timeout: 500ms
cloud_save:
Expand Down

0 comments on commit 2720b21

Please sign in to comment.