From 8eb7b814d2b4ba84597a284ba498b158033ac106 Mon Sep 17 00:00:00 2001 From: Frikky Date: Tue, 1 Oct 2024 11:55:33 +0200 Subject: [PATCH] Cleaned up unecessary logs and fixed notification mapping --- detection.go | 2 +- notifications.go | 4 +++- oauth2.go | 3 ++- shared.go | 5 +++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/detection.go b/detection.go index 38f380d..10654c1 100644 --- a/detection.go +++ b/detection.go @@ -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() /* diff --git a/notifications.go b/notifications.go index 851c13e..e17ea2f 100755 --- a/notifications.go +++ b/notifications.go @@ -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) } } @@ -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, ¬ification) if err != nil { diff --git a/oauth2.go b/oauth2.go index 1cdb74f..aa0b5ad 100755 --- a/oauth2.go +++ b/oauth2.go @@ -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 diff --git a/shared.go b/shared.go index 0a0f7f7..131f637 100755 --- a/shared.go +++ b/shared.go @@ -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") != "" { @@ -23865,6 +23865,7 @@ func GetExternalClient(baseUrl string) *http.Client { } } } + transport.TLSClientConfig = &tls.Config{RootCAs: rootCAs} } }