From 2be6f3830615c211c18d5697f9c458401b653db1 Mon Sep 17 00:00:00 2001 From: streamer45 Date: Wed, 25 May 2022 12:53:09 +0200 Subject: [PATCH] Cleanup rtcd URL from credentials --- server/rtcd.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/server/rtcd.go b/server/rtcd.go index ed920de8c..a546e07d4 100644 --- a/server/rtcd.go +++ b/server/rtcd.go @@ -389,7 +389,12 @@ func (m *rtcdClientManager) getRTCDClientConfig(rtcdURL string, dialFn rtcd.Dial // Give precedence to environment to override everything else. cfg.ClientID = os.Getenv("MM_CLOUD_INSTALLATION_ID") if cfg.ClientID == "" { + if isCloud(m.ctx.pluginAPI.System.GetLicense()) { + m.ctx.LogError("installation id is missing") + } cfg.ClientID = os.Getenv("CALLS_RTCD_CLIENT_ID") + } else { + m.ctx.LogDebug("installation id is set", "id", cfg.ClientID) } cfg.AuthKey = os.Getenv("CALLS_RTCD_AUTH_KEY") cfg.URL = rtcdURL @@ -398,15 +403,16 @@ func (m *rtcdClientManager) getRTCDClientConfig(rtcdURL string, dialFn rtcd.Dial } // Parsing the URL in case it's already containing credentials. + u, clientID, authKey, err := parseURL(cfg.URL) + if err != nil { + return cfg, fmt.Errorf("failed to parse URL: %w", err) + } if cfg.ClientID == "" && cfg.AuthKey == "" { - u, clientID, authKey, err := parseURL(cfg.URL) - if err != nil { - return cfg, fmt.Errorf("failed to parse URL: %w", err) - } cfg.ClientID = clientID cfg.AuthKey = authKey - cfg.URL = u } + // Updating to the clean URL (with credentials stripped if present). + cfg.URL = u // if no URL has been provided until now we fail with error. if cfg.URL == "" {