service backend
This commit is contained in:
22
api/pkg/db/internal/mongo/mongo.go
Normal file
22
api/pkg/db/internal/mongo/mongo.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package mongo
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
func buildURI(s *DBSettings) string {
|
||||
u := &url.URL{
|
||||
Scheme: "mongodb",
|
||||
Host: s.Host,
|
||||
Path: "/" + url.PathEscape(s.Database), // /my%20db
|
||||
}
|
||||
|
||||
q := url.Values{}
|
||||
if s.ReplicaSet != "" {
|
||||
q.Set("replicaSet", s.ReplicaSet)
|
||||
}
|
||||
|
||||
u.RawQuery = q.Encode()
|
||||
|
||||
return u.String()
|
||||
}
|
||||
Reference in New Issue
Block a user