1package main
2
3import (
4 "embed"
5 "flag"
6 "fmt"
7
8 "git.sr.ht/~gabrielgio/midr/db"
9 "git.sr.ht/~gabrielgio/midr/routes"
10 "github.com/gin-gonic/gin"
11)
12
13var Version = "development"
14var dataDir = flag.String("d", ".", "Folder where midr will store the data")
15var production = flag.Bool("p", false, "Set production")
16
17//go:embed assets/* templates/*
18var f embed.FS
19
20func main() {
21 flag.Parse()
22 fmt.Println("Version:\t", Version)
23 fmt.Println("Datadir:\t", *dataDir)
24
25 if *production {
26 gin.SetMode(gin.ReleaseMode)
27 }
28
29 db.ConnectDb(*dataDir)
30 routes.HandleRequests(f)
31}