cspj-application/server/main.go

34 lines
717 B
Go
Raw Normal View History

2024-11-11 15:43:09 +08:00
package main
import (
"log"
2024-11-11 17:34:37 +08:00
"github.com/Vomitblood/cspj-application/server/internal/db"
"github.com/Vomitblood/cspj-application/server/internal/http_server"
2025-02-09 18:51:53 +08:00
"github.com/Vomitblood/cspj-application/server/internal/log_watcher"
2025-02-09 16:34:46 +08:00
"github.com/Vomitblood/cspj-application/server/internal/telegram"
2025-02-09 18:51:53 +08:00
"github.com/Vomitblood/cspj-application/server/internal/webdav"
2024-11-11 15:43:09 +08:00
)
func main() {
var err error
2024-11-11 17:34:37 +08:00
db.DbPool, err = db.ConnectToDb()
2024-11-11 15:43:09 +08:00
if err != nil {
log.Fatalf("Failed to connect to db: %v", err)
}
2024-11-11 17:34:37 +08:00
defer db.DbPool.Close()
2024-11-11 15:43:09 +08:00
2025-02-09 18:51:53 +08:00
// init webdav client
client := webdav.Init()
// init telegram bot
tgBot := telegram.Init(client)
// start log watcher
go log_watcher.WatchFile(tgBot)
//
2025-02-09 16:34:46 +08:00
2024-11-11 17:34:37 +08:00
http_server.ServeApi()
2024-11-11 15:43:09 +08:00
}