forked from ZeStream/zestream-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
50 lines (39 loc) · 892 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
46
47
48
49
50
package main
import (
"fmt"
"log"
"net/http"
"os"
"zestream-server/configs"
"zestream-server/constants"
"zestream-server/routes"
"zestream-server/service"
"zestream-server/utils"
)
func dev() {
utils.Fetch("https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/WeAreGoingOnBullrun.mp4", "Test.mp4")
service.GenerateDash("Test.mp4")
}
func main() {
configs.LoadEnv()
r := routes.Init()
port := os.Getenv(constants.PORT)
kafkaURI := os.Getenv("KAFKA_URI")
if kafkaURI == "" {
log.Fatal("Error: KAFKA_URI environment variable not set")
}
if port == "" {
port = constants.DEFAULT_PORT
}
server := &http.Server{
Addr: port,
ReadTimeout: constants.READ_TIMEOUT,
WriteTimeout: constants.WRITE_TIMEOUT,
IdleTimeout: constants.IDLE_TIMEOUT,
}
err := server.ListenAndServe()
if err != nil {
fmt.Println(err)
}
r.Run(":" + port)
}