-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (32 loc) · 888 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 (
"crypto-performance-compare/crypto"
"crypto-performance-compare/httpservice"
"crypto-performance-compare/utils"
"github.com/joho/godotenv"
)
func main() {
// Load env vars
godotenv.Load()
// Init custom logger
logger := utils.NewLogger()
logger.Println("Starting service....")
// Init cache
cache := crypto.NewCache()
// Init Crypto Updater
updater := crypto.NewUpdater(logger, cache)
// Start the continuous update procedure
err := updater.UpdateAll()
if err != nil {
logger.Println(utils.ColorError, "Error starting the update procedure:", err.Error())
return
}
// Init & start HTTP server
srv := httpservice.NewServer(cache)
logger.Println("Starting HTTP server on http://localhost" + utils.GetPort())
err = srv.Start()
if err != nil {
logger.Println(utils.ColorError, "Error starting HTTP server:", err.Error())
return
}
}