aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
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)