This commit is contained in:
41666 2025-03-24 23:44:07 -07:00
parent 4fc045e037
commit b9a05bedf9
8 changed files with 45 additions and 119 deletions

23
main.go
View file

@ -1,20 +1,23 @@
package main // import "git.sapphic.engineer/roleypoly/v4"
import (
"embed"
"log"
"net/http"
"os"
"github.com/goccy/go-json"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/middleware/session"
"github.com/gofiber/storage/pebble/v2"
"github.com/gofiber/template/html/v2"
)
func main() {
storageDir := getStorageDirectory()
//go:embed templates/*
var templatesfs embed.FS
viewEngine := html.New("./templates", ".html")
func main() {
// storageDir := getStorageDirectory()
viewEngine := html.NewFileSystem(http.FS(templatesfs), ".html")
app := fiber.New(fiber.Config{
JSONEncoder: json.Marshal,
@ -23,11 +26,11 @@ func main() {
ViewsLayout: "main",
})
app.Use(session.New(session.Config{
Storage: pebble.New(pebble.Config{
Path: storageDir + "/sessions",
}),
}))
// app.Use(session.New(session.Config{
// Storage: pebble.New(pebble.Config{
// Path: storageDir + "/sessions",
// }),
// }))
listenAddr := os.Getenv("LISTEN_ADDR")
if listenAddr == "" {