-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (36 loc) · 774 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
41
42
43
44
45
package main
import (
"auxstream/api"
"auxstream/cache"
"auxstream/db"
fs "auxstream/file_system"
"auxstream/utils"
"context"
"log"
"github.com/gin-gonic/gin"
"github.com/redis/go-redis/v9"
)
func main() {
config, err := utils.LoadConfig(".")
if err != nil {
log.Fatal("could not load env config: ", err.Error())
}
dB := db.InitDB(config, context.Background())
gin.SetMode(config.GinMode)
rc := cache.NewRedis(&redis.Options{
Addr: config.RedisAddr,
})
err = fs.SetFileStore(config)
if err != nil {
log.Fatalf("failed set file store: %s", err.Error())
}
server := api.NewServer(api.ServerConfig{
Cache: rc,
DB: dB,
Conf: config,
})
err = server.Run()
if err != nil {
log.Fatalf("failed to start server: ", err.Error())
}
}