-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
56 lines (47 loc) · 1.14 KB
/
main.go
File metadata and controls
56 lines (47 loc) · 1.14 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"flag"
"github.com/BankEx/ebh/config"
"github.com/BankEx/ebh/handlers"
"github.com/BankEx/ebh/router"
"log"
"net/http"
"github.com/BankEx/ebh/repositories"
)
func main() {
var configPathPtr string
flag.StringVar(&configPathPtr, "config-path", "./config/config.yml", "A path to config file")
flag.Parse()
// Config
conf, err := config.LoadConfig(configPathPtr)
if err != nil {
panic(err)
}
//nodeService, err := services.NewNodeReader(conf)
//if err != nil {
// panic(err)
//}
//log.Printf("ETHService is initialised")
//cache := make(chan ratestates.RateState, conf.Cache)
//err = btcService.ConnectToDB()
//if err != nil {
// panic(err)
//}
//defer btcService.CloseDBConnection()
//
//err = btcService.StartListenBTC()
//if err != nil {
// panic(err)
//}
//defer btcService.StopListenBTC()
mongo, err := repositories.New(conf.DBConfig)
if err != nil {
panic(err)
}
log.Printf("MongoWriter is initialised")
//go mongo.Start(cache)
handlers := handlers.New(nil, mongo)
r := router.New(handlers)
log.Printf("Server is listening on %s port", conf.Port)
log.Panic(http.ListenAndServe(conf.Port, r))
}