Merge pull request #9 from Selly-Modules/beta
upgrade mongodb version to 1.0.1
This commit is contained in:
commit
ab9bfaacb7
2
go.mod
2
go.mod
|
@ -4,7 +4,7 @@ go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Selly-Modules/logger v0.0.0-20210809034923-140a51f39ec9
|
github.com/Selly-Modules/logger v0.0.0-20210809034923-140a51f39ec9
|
||||||
github.com/Selly-Modules/mongodb v0.0.0-20211013094205-a8ab24a96c4c
|
github.com/Selly-Modules/mongodb v1.0.1
|
||||||
github.com/go-redis/redis/v8 v8.11.4
|
github.com/go-redis/redis/v8 v8.11.4
|
||||||
github.com/logrusorgru/aurora v2.0.3+incompatible
|
github.com/logrusorgru/aurora v2.0.3+incompatible
|
||||||
github.com/thoas/go-funk v0.9.1
|
github.com/thoas/go-funk v0.9.1
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1,8 +1,8 @@
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/Selly-Modules/logger v0.0.0-20210809034923-140a51f39ec9 h1:AuJ/IIZ7yppyP19ILEYkwz26CwGXR4xUyXANKSG0+1U=
|
github.com/Selly-Modules/logger v0.0.0-20210809034923-140a51f39ec9 h1:AuJ/IIZ7yppyP19ILEYkwz26CwGXR4xUyXANKSG0+1U=
|
||||||
github.com/Selly-Modules/logger v0.0.0-20210809034923-140a51f39ec9/go.mod h1:RWhSQ3F01an8KD00VjzRBZOMcE5eV2Cy0/l4ZkeieyU=
|
github.com/Selly-Modules/logger v0.0.0-20210809034923-140a51f39ec9/go.mod h1:RWhSQ3F01an8KD00VjzRBZOMcE5eV2Cy0/l4ZkeieyU=
|
||||||
github.com/Selly-Modules/mongodb v0.0.0-20211013094205-a8ab24a96c4c h1:1l6QmAl43maG9zFyUXrPQVUjyVt0vy/2Saz992UR+Sc=
|
github.com/Selly-Modules/mongodb v1.0.1 h1:TeBIs2VG4EbE0uAN71bD11zv5X0M7AvJfEcID3TzwIw=
|
||||||
github.com/Selly-Modules/mongodb v0.0.0-20211013094205-a8ab24a96c4c/go.mod h1:C9O0Bgl9i6szjntMjBdEvaFSqG2UPOgHUspIWIJ93JQ=
|
github.com/Selly-Modules/mongodb v1.0.1/go.mod h1:OhqdqYqh8WqEEruz6U27Wu1kKoBLwIUQsc+56xl0Wcs=
|
||||||
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
|
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
|
||||||
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||||
|
|
17
usermngmt.go
17
usermngmt.go
|
@ -6,17 +6,13 @@ import (
|
||||||
|
|
||||||
"github.com/Selly-Modules/logger"
|
"github.com/Selly-Modules/logger"
|
||||||
"github.com/Selly-Modules/mongodb"
|
"github.com/Selly-Modules/mongodb"
|
||||||
|
|
||||||
"github.com/Selly-Modules/usermngmt/cache"
|
"github.com/Selly-Modules/usermngmt/cache"
|
||||||
configMoudle "github.com/Selly-Modules/usermngmt/config"
|
configMoudle "github.com/Selly-Modules/usermngmt/config"
|
||||||
"github.com/Selly-Modules/usermngmt/database"
|
"github.com/Selly-Modules/usermngmt/database"
|
||||||
"github.com/Selly-Modules/usermngmt/internal"
|
"github.com/Selly-Modules/usermngmt/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MongoDBConfig ...
|
|
||||||
type MongoDBConfig struct {
|
|
||||||
Host, User, Password, DBName, Mechanism, Source string
|
|
||||||
}
|
|
||||||
|
|
||||||
// RedisConfig ...
|
// RedisConfig ...
|
||||||
type RedisConfig struct {
|
type RedisConfig struct {
|
||||||
URI, Password string
|
URI, Password string
|
||||||
|
@ -25,7 +21,7 @@ type RedisConfig struct {
|
||||||
// Config ...
|
// Config ...
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// MongoDB config, for save documents
|
// MongoDB config, for save documents
|
||||||
MongoDB MongoDBConfig
|
MongoDB mongodb.Config
|
||||||
|
|
||||||
// Redis
|
// Redis
|
||||||
Redis RedisConfig
|
Redis RedisConfig
|
||||||
|
@ -59,14 +55,7 @@ func Init(config Config) (*Service, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect MongoDB
|
// Connect MongoDB
|
||||||
db, err := mongodb.Connect(
|
db, err := mongodb.Connect(config.MongoDB)
|
||||||
config.MongoDB.Host,
|
|
||||||
config.MongoDB.User,
|
|
||||||
config.MongoDB.Password,
|
|
||||||
config.MongoDB.DBName,
|
|
||||||
config.MongoDB.Mechanism,
|
|
||||||
config.MongoDB.Source,
|
|
||||||
)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Cannot init module User MANAGEMENT", err)
|
fmt.Println("Cannot init module User MANAGEMENT", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue