mirror of
https://github.com/strukturag/nextcloud-spreed-signaling.git
synced 2025-04-11 06:11:18 +00:00
nats: do not log url credentials
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
parent
76fa9abd33
commit
471469f1c8
1 changed files with 10 additions and 1 deletions
|
@ -27,6 +27,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
|
@ -101,7 +102,7 @@ func NewNatsClient(url string) (NatsClient, error) {
|
|||
|
||||
client.conn, err = nats.Connect(url)
|
||||
}
|
||||
log.Printf("Connection established to %s (%s)", client.conn.ConnectedUrl(), client.conn.ConnectedServerId())
|
||||
log.Printf("Connection established to %s (%s)", removeURLCredentials(client.conn.ConnectedUrl()), client.conn.ConnectedServerId())
|
||||
return client, nil
|
||||
}
|
||||
|
||||
|
@ -153,3 +154,11 @@ func (c *natsClient) Decode(msg *nats.Msg, vPtr interface{}) (err error) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
func removeURLCredentials(u string) string {
|
||||
if u, err := url.Parse(u); err == nil && u.User != nil {
|
||||
u.User = url.User("***")
|
||||
return u.String()
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue