From af542e339e5a611d2a1b5876450bee841b577640 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Thu, 5 May 2022 10:05:40 -0700 Subject: removed redis dependency --- main.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 4eb219a..90d7f13 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( "fmt" "html/template" "io/ioutil" + "log" "math/rand" "path" "regexp" @@ -18,6 +19,7 @@ import ( "github.com/FChannel0/FChannel-Server/util" "github.com/FChannel0/FChannel-Server/webfinger" "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/middleware/encryptcookie" "github.com/gofiber/fiber/v2/middleware/logger" "github.com/gofiber/template/html" @@ -29,7 +31,6 @@ func main() { Init() defer db.Close() - defer db.CloseCache() // Routing and templates template := html.New("./views", ".html") @@ -44,6 +45,16 @@ func main() { app.Use(logger.New()) + cookieKey, err := util.GetCookieKey() + + if err != nil { + log.Println(err) + } + + app.Use(encryptcookie.New(encryptcookie.Config{ + Key: cookieKey, + })) + app.Static("/static", "./views") app.Static("/static", "./static") app.Static("/public", "./public") @@ -111,8 +122,6 @@ func Init() { db.ConnectDB() - db.InitCache() - db.RunDatabaseSchema() go db.MakeCaptchas(100) -- cgit v1.2.3