-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
31 lines (27 loc) · 947 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
package main
import (
"game-server-selector/internal/domain"
serverhttp "game-server-selector/internal/server/http"
"game-server-selector/internal/services"
"game-server-selector/internal/storage"
"net/http"
)
func main() {
configService := services.NewConfigService()
//TODO: after added new storage support we need to check config and init storage
inMemoryStorage := storage.NewInMemoryStorage()
metricService := services.NewMetricService()
metricService.Register()
serverService := services.NewServerService(inMemoryStorage, metricService)
serverDomain := domain.NewServerDomain(serverService, configService)
if configService.IsPrometheusEnabled() {
handler := metricService.Handler()
http.Handle("/metrics", handler)
go http.ListenAndServe(configService.GetPrometheusPort(), nil)
}
fiber := serverhttp.NewFiberServer(serverDomain, configService, metricService)
err := fiber.Start()
if err != nil {
panic(err)
}
}