Skip to content

Commit

Permalink
Cleaned up unecessary logs and fixed notification mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Oct 1, 2024
1 parent 0b72b8b commit 8eb7b81
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion detection.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func HandleDetectionHealthUpdate(resp http.ResponseWriter, request *http.Request
return
}

log.Printf("[DEBUG] Tenzir health update: %#v", healthUpdate)
//log.Printf("[DEBUG] Tenzir health update: %#v", healthUpdate)

//ctx := context.Background()
/*
Expand Down
4 changes: 3 additions & 1 deletion notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ func CreateOrgNotification(ctx context.Context, title, description, referenceUrl
} else {
err = sendToNotificationWorkflow(ctx, mainNotification, selectedApikey, org.Defaults.NotificationWorkflow, false)
if err != nil {
if !strings.Contains(err.Error(), "cache stored") {
if !strings.Contains(err.Error(), "cache stored") && !strings.Contains(err.Error(), "Same workflow") {
log.Printf("[ERROR] Failed sending notification to workflowId %s for reference %s (2): %s", org.Defaults.NotificationWorkflow, mainNotification.Id, err)
}
}
Expand Down Expand Up @@ -907,6 +907,8 @@ func HandleCreateNotification(resp http.ResponseWriter, request *http.Request) {
return
}

//log.Printf("[DEBUG] Creating notification based on: %s", string(body))

notification := Notification{}
err = json.Unmarshal(body, &notification)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -3919,7 +3919,8 @@ func RunOauth2Request(ctx context.Context, user User, appAuth AppAuthenticationS
}

if strings.Contains(string(respBody), "error") {
log.Printf("\n\n[ERROR] Oauth2 RESPONSE: %s\n\nencoded: %#v", string(respBody), v.Encode())
//log.Printf("\n\n[ERROR] Oauth2 RESPONSE: %s\n\nencoded: %#v\n", string(respBody), v.Encode())
log.Printf("\n\n[ERROR] Oauth2 RESPONSE from %s: %s", url, string(respBody))
}

// Check if we have an authentication token and pre-set it
Expand Down
5 changes: 3 additions & 2 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -23843,12 +23843,12 @@ func GetExternalClient(baseUrl string) *http.Client {
}

certDir := "/certs/"

if os.Getenv("SHUFFLE_CERT_DIR") != "" {
certDir = os.Getenv("SHUFFLE_CERT_DIR")

log.Printf("[INFO] Reading self signed certificates from custom dir '%s'", certDir)
}

log.Printf("[INFO] Reading self signed certificates from %s dir", certDir)

files, err := os.ReadDir(certDir)
if err == nil && os.Getenv("SHUFFLE_CERT_DIR") != "" {
Expand All @@ -23865,6 +23865,7 @@ func GetExternalClient(baseUrl string) *http.Client {
}
}
}

transport.TLSClientConfig = &tls.Config{RootCAs: rootCAs}
}
}
Expand Down

0 comments on commit 8eb7b81

Please sign in to comment.