Skip to content

Commit

Permalink
fix: handle mongo host without port
Browse files Browse the repository at this point in the history
  • Loading branch information
javascriptizer1 committed Jun 15, 2024
1 parent cf07cc9 commit a7c0a11
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/client/mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ type Config struct {
}

func (c *Config) toURL() string {
if c.Port == "" {
return fmt.Sprintf("mongodb+srv://%s:%s@%s", c.User, c.Password, c.Host)
}

return fmt.Sprintf("mongodb://%s:%s@%s:%s", c.User, c.Password, c.Host, c.Port)
}

Expand Down

0 comments on commit a7c0a11

Please sign in to comment.