mirror of
https://github.com/gofiber/storage.git
synced 2025-10-06 09:07:14 +08:00
Ignore port when using Atlas
This commit is contained in:
@@ -48,7 +48,11 @@ func New(config ...Config) *Storage {
|
|||||||
if cfg.Username != "" || cfg.Password != "" {
|
if cfg.Username != "" || cfg.Password != "" {
|
||||||
dsn += "@"
|
dsn += "@"
|
||||||
}
|
}
|
||||||
dsn += fmt.Sprintf("%s:%d", url.QueryEscape(cfg.Host), cfg.Port)
|
if cfg.Atlas == true {
|
||||||
|
dsn += url.QueryEscape(cfg.Host) // Cannot specify port when using MongoDB Atlas
|
||||||
|
} else {
|
||||||
|
dsn += fmt.Sprintf("%s:%d", url.QueryEscape(cfg.Host), cfg.Port)
|
||||||
|
}
|
||||||
|
|
||||||
// Set mongo options
|
// Set mongo options
|
||||||
opt := options.Client()
|
opt := options.Client()
|
||||||
|
Reference in New Issue
Block a user