Mythus commited on
Commit
a545b03
·
1 Parent(s): 007d9a7

Delete main.go

Browse files
Files changed (1) hide show
  1. main.go +0 -64
main.go DELETED
@@ -1,64 +0,0 @@
1
- package main
2
-
3
- import (
4
- "fmt"
5
- "path/filepath"
6
- "time"
7
-
8
- "github.com/divyam234/teldrive/cache"
9
- "github.com/divyam234/teldrive/database"
10
- "github.com/divyam234/teldrive/routes"
11
- "github.com/divyam234/teldrive/utils"
12
-
13
- "github.com/divyam234/cors"
14
- "github.com/divyam234/teldrive/utils/cron"
15
- "github.com/gin-gonic/gin"
16
- "github.com/go-co-op/gocron"
17
- )
18
-
19
- func main() {
20
-
21
- gin.SetMode(gin.ReleaseMode)
22
-
23
- router := gin.Default()
24
-
25
- utils.InitConfig()
26
-
27
- utils.InitializeLogger()
28
-
29
- database.InitDB()
30
-
31
- cache.CacheInit()
32
-
33
- utils.InitBotClients()
34
-
35
- cron.FilesDeleteJob()
36
-
37
- scheduler := gocron.NewScheduler(time.UTC)
38
-
39
- scheduler.Every(1).Hours().Do(cron.FilesDeleteJob)
40
-
41
- router.Use(cors.New(cors.Config{
42
- AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"},
43
- AllowHeaders: []string{"Origin", "Content-Length", "Content-Type"},
44
- AllowCredentials: true,
45
- AllowOriginFunc: func(origin string) bool {
46
- return true
47
- },
48
- MaxAge: 12 * time.Hour,
49
- }))
50
-
51
- router.Use(gin.ErrorLogger())
52
-
53
- routes.GetRoutes(router)
54
-
55
- config := utils.GetConfig()
56
- certDir := filepath.Join(config.ExecDir, "sslcerts")
57
- ok, _ := utils.PathExists(certDir)
58
- if ok && config.Https {
59
- router.RunTLS(fmt.Sprintf(":%d", config.Port), filepath.Join(certDir, "cert.pem"), filepath.Join(certDir, "key.pem"))
60
- } else {
61
- router.Run(fmt.Sprintf(":%d", config.Port))
62
- }
63
- scheduler.StartAsync()
64
- }