Skip to content

Commit

Permalink
Rename Connection to ConnectionURL
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalissaac committed Dec 2, 2020
1 parent e5d9b06 commit ea23fab
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
22 changes: 11 additions & 11 deletions mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ store := mongodb.New(mongodb.Config{

// Initialize custom config using connection string
store := mongodb.New(mongodb.Config{
Connection: "mongodb://user:[email protected]:27017",
Database: "fiber",
Collection: "fiber_storage",
Reset: false,
ConnectionURI: "mongodb://user:[email protected]:27017",
Database: "fiber",
Collection: "fiber_storage",
Reset: false,
})

```
Expand All @@ -64,7 +64,7 @@ type Config struct {
// Connection string to use for DB. Will override all other authentication values if used
//
// Optional. Default is ""
Connection string
ConnectionURI string

// Host name where the DB is hosted
//
Expand Down Expand Up @@ -106,11 +106,11 @@ type Config struct {
### Default Config
```go
var ConfigDefault = Config{
Connection: "",
Host: "127.0.0.1",
Port: 27017,
Database: "fiber",
Collection: "fiber_storage",
Reset: false,
ConnectionURI: "",
Host: "127.0.0.1",
Port: 27017,
Database: "fiber",
Collection: "fiber_storage",
Reset: false,
}
```
14 changes: 7 additions & 7 deletions mongodb/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type Config struct {
// Connection string to use for DB. Will override all other authentication values if used
//
// Optional. Default is ""
Connection string
ConnectionURI string

// Host name where the DB is hosted
//
Expand Down Expand Up @@ -45,12 +45,12 @@ type Config struct {

// ConfigDefault is the default config
var ConfigDefault = Config{
Connection: "",
Host: "127.0.0.1",
Port: 27017,
Database: "fiber",
Collection: "fiber_storage",
Reset: false,
ConnectionURI: "",
Host: "127.0.0.1",
Port: 27017,
Database: "fiber",
Collection: "fiber_storage",
Reset: false,
}

// Helper function to set default values
Expand Down
4 changes: 2 additions & 2 deletions mongodb/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func New(config ...Config) *Storage {
var dsn string

// Check if user supplied connection string
if cfg.Connection != "" {
dsn = cfg.Connection
if cfg.ConnectionURI != "" {
dsn = cfg.ConnectionURI
} else {
dsn = "mongodb://"
if cfg.Username != "" {
Expand Down

0 comments on commit ea23fab

Please sign in to comment.