-
Notifications
You must be signed in to change notification settings - Fork 72
/
main.go
43 lines (38 loc) · 1.27 KB
/
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
package main
import (
"io/ioutil"
"log"
"github.com/NYTimes/gizmo/server"
"github.com/google/gops/agent"
"github.com/video-dev/video-transcoding-api/v2/config"
_ "github.com/video-dev/video-transcoding-api/v2/internal/provider/bitmovin"
_ "github.com/video-dev/video-transcoding-api/v2/internal/provider/elementalconductor"
_ "github.com/video-dev/video-transcoding-api/v2/internal/provider/encodingcom"
_ "github.com/video-dev/video-transcoding-api/v2/internal/provider/hybrik"
_ "github.com/video-dev/video-transcoding-api/v2/internal/provider/mediaconvert"
_ "github.com/video-dev/video-transcoding-api/v2/internal/provider/zencoder"
"github.com/video-dev/video-transcoding-api/v2/service"
)
func main() {
agent.Listen(agent.Options{})
defer agent.Close()
cfg := config.LoadConfig()
server.Init("video-transcoding-api", cfg.Server)
server.Log.Out = ioutil.Discard
logger, err := cfg.Log.Logger()
if err != nil {
log.Fatal(err)
}
service, err := service.NewTranscodingService(cfg, logger)
if err != nil {
logger.Fatal("unable to initialize service: ", err)
}
err = server.Register(service)
if err != nil {
logger.Fatal("unable to register service: ", err)
}
err = server.Run()
if err != nil {
logger.Fatal("server encountered a fatal error: ", err)
}
}