update: new logging functions
This commit is contained in:
34
main.go
34
main.go
@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
* security | MatterLinux Package Security Tracker
|
||||
* security | MatterLinux package security tracker
|
||||
* MatterLinux 2023-2024 (https://matterlinux.xyz)
|
||||
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -21,17 +21,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"git.matterlinux.xyz/matter/security/lib"
|
||||
"git.matterlinux.xyz/matter/security/log"
|
||||
"git.matterlinux.xyz/matter/security/routes"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/template/html/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.SetFlags(log.Lshortfile | log.Ltime)
|
||||
|
||||
engine := html.New("./templates", ".html")
|
||||
app := fiber.New(fiber.Config{
|
||||
DisableStartupMessage: true,
|
||||
@ -40,29 +37,30 @@ func main() {
|
||||
|
||||
err := lib.LoadDatabase()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to load database: %s", err.Error())
|
||||
log.Error("Failed to load database: %s", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
app.Static("/", "./public")
|
||||
app.Get("/", routes.GETIndex)
|
||||
app.Get("/details/:id", routes.GETDetails)
|
||||
app.Get("/", routes.GET_Index)
|
||||
app.Get("/details/:id", routes.GET_Details)
|
||||
|
||||
app.Get("/login", routes.GETLogin)
|
||||
app.Post("/login", routes.POSTLogin)
|
||||
app.Get("/login", routes.GET_Login)
|
||||
app.Post("/login", routes.POST_Login)
|
||||
|
||||
app.Use("/manage", routes.MiddleAuth)
|
||||
app.Get("/manage", routes.GETManage)
|
||||
app.Get("/manage/logout", routes.GETLogout)
|
||||
app.Post("/manage/new", routes.POSTNew)
|
||||
app.Post("/manage/status", routes.POSTStatus)
|
||||
app.Get("/manage", routes.GET_Manage)
|
||||
app.Get("/manage/logout", routes.GET_Logout)
|
||||
app.Post("/manage/new", routes.POST_New)
|
||||
app.Post("/manage/status", routes.POST_Status)
|
||||
|
||||
app.Get("*", func(c *fiber.Ctx) error {
|
||||
return lib.RenderError(c, 404)
|
||||
})
|
||||
|
||||
log.Printf("Starting MatterLinux Security Tracker on port 9876")
|
||||
err = app.Listen(":9876")
|
||||
if err != nil {
|
||||
log.Fatalf("Error starting server: %s", err)
|
||||
log.Info("Starting MatterLinux security tracker on port 9876")
|
||||
|
||||
if err = app.Listen(":9876"); err != nil {
|
||||
log.Info("Error starting server: %s", err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user