-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
36 lines (30 loc) · 881 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
package main
import (
"flag"
"log"
"github.com/AmbitiousJun/live-server/internal/service/resolve/handler"
"github.com/AmbitiousJun/live-server/internal/service/secret"
"github.com/AmbitiousJun/live-server/internal/service/whitearea"
"github.com/AmbitiousJun/live-server/internal/service/ytdlp"
"github.com/AmbitiousJun/live-server/internal/web"
"github.com/gin-gonic/gin"
)
func main() {
port := flag.Int("p", 5666, "自定义程序运行的端口号")
prod := flag.Bool("prod", false, "是否开启线上模式")
flag.Parse()
if *prod {
gin.SetMode(gin.ReleaseMode)
}
handler.Init()
ytdlp.Init()
if err := secret.Init(); err != nil {
log.Panicf("初始化程序密钥失败: %v", err)
}
if err := whitearea.Init(); err != nil {
log.Panicf("初始化地域白名单失败: %v", err)
}
if err := web.Listen(*port); err != nil {
log.Panic(err)
}
}