aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorFChannel <>2022-05-05 10:05:40 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commitaf542e339e5a611d2a1b5876450bee841b577640 (patch)
tree987f4fce83d49605a0a81d68fcfac9b2d57cf8a7 /main.go
parent493fc8e025fd613d9faf0b573d610e4a0e0c0228 (diff)
removed redis dependency
Diffstat (limited to 'main.go')
-rw-r--r--main.go15
1 files changed, 12 insertions, 3 deletions
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)