Skip to content

Commit

Permalink
Missing file for previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuratczyk committed Feb 20, 2024
1 parent 64a6f4f commit 6ac48db
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pkg/amqp10_client/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package amqp10_client

import (
"net/url"
"os"
"strings"

"github.com/rabbitmq/omq/pkg/log"
)

func amqpVHost(connectionString string) string {
uri, err := url.Parse(connectionString)
if err != nil {
log.Error("failed to parse connection string", "error", err.Error())
os.Exit(1)
}

vhost := "/"
if uri.Path != "/" {
vhost = strings.TrimPrefix(uri.Path, "/")
}

return "vhost:" + vhost
}

0 comments on commit 6ac48db

Please sign in to comment.