- Timestamp:
- Jan 21, 2024, 2:42:45 AM (17 months ago)
- Location:
- trunk/cmd/mai
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cmd/mai/main.go
r60 r61 5 5 "net/http" 6 6 "net/url" 7 "os" 7 8 "time" 8 9 "runtime" … … 10 11 "marisa.chaotic.ninja/mai/engines" 11 12 "github.com/gofiber/fiber/v2" 13 "github.com/gofiber/fiber/v2/middleware/logger" 14 "github.com/gofiber/fiber/v2/middleware/limiter" 12 15 "github.com/gofiber/template/html/v2" 13 16 ) … … 17 20 var conf struct { 18 21 listen string 22 redisuri string 19 23 staticpath string 20 24 tmplpath string … … 34 38 engine := html.New(conf.tmplpath, ".html") 35 39 engine.AddFunc("inc", func(i int) int { return i + 1 }) 36 37 app := fiber.New(fiber.Config{ 38 Views: engine, 39 }) 40 storage := redis.New( 41 redis.Config{ 42 URL: conf.redisuri, 43 }, 44 ) 45 46 app := fiber.New( 47 fiber.Config{ 48 AppName: "Mai", 49 DisableStartupMessage: true, 50 Views: engine, 51 }) 52 53 app.Use(logger.New( 54 logger.Config{ 55 Format: "==> ${ip}:${port} ${status} - ${method} ${path}\n", 56 DisableColors: true, 57 Output: os.Stdout, 58 }, 59 )) 60 61 app.Use(limiter.New()) 40 62 41 63 app.All("/", func(c *fiber.Ctx) error { -
trunk/cmd/mai/readconf.go
r56 r61 13 13 14 14 conf.listen = cfg.Section("mai").Key("listen").String() 15 conf.staticpath = cfg.Section("mai").Key(" rootdir").String()16 conf.tmplpath = cfg.Section("mai").Key("t mplpath").String()15 conf.staticpath = cfg.Section("mai").Key("static").String() 16 conf.tmplpath = cfg.Section("mai").Key("templates").String() 17 17 18 18 return nil
Note:
See TracChangeset
for help on using the changeset viewer.