CCTV/cmd/main.go
2025-02-21 23:37:34 +01:00

42 lines
681 B
Go

package main
import (
"net/http"
"time"
"git.neunzweinull.com/jan/CCTV/config"
"git.neunzweinull.com/jan/CCTV/internal"
)
const (
CleanupInterval = 5 * time.Minute
)
func init() {
//Load the env file
config.LoadEnv()
//Initialize the log file
internal.InitLog()
//Initialize the Upload Directory
config.InitUploadDir()
//Start background cleanup for expired bans
go func() {
for {
time.Sleep(CleanupInterval)
internal.CleanupBans()
}
}()
}
func main() {
defer internal.CloseLog()
http.HandleFunc("/upload", internal.AuthMiddleware(internal.UploadHandler))
http.HandleFunc("/health", internal.HealthHandler)
http.ListenAndServe(":8080", nil)
}