-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (31 loc) · 755 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"log"
"os"
"time"
"github.com/daugminas/kyc/app/adapter"
"github.com/daugminas/kyc/app/delivery"
"github.com/daugminas/kyc/lib/db"
"github.com/labstack/echo/v4"
"github.com/joho/godotenv"
)
func main() {
// env variables
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
// db connection
dbObj := db.New(&db.Options{
MongoURI: os.Getenv("MONGO_URI"),
DatabaseName: os.Getenv("MONGO_DB"),
DialTimeout: 10 * time.Second,
})
// user adapter
userAdapter := adapter.NewUserAdapter(dbObj, os.Getenv("USERS_COLLECTION"))
// server init, start
e := echo.New()
server := delivery.NewServer(e, userAdapter)
server.RegisterRouter()
server.Start(os.Getenv("SERVER_URI"))
}