this repo has no description
1package main
2
3import (
4 "flag"
5 "fmt"
6 "html/template"
7 "log"
8 "net/http"
9 "path/filepath"
10
11 "github.com/icyphox/bild/legit/config"
12 "github.com/icyphox/bild/legit/routes"
13)
14
15func main() {
16 var cfg string
17 flag.StringVar(&cfg, "config", "./config.yaml", "path to config file")
18 flag.Parse()
19
20 c, err := config.Read(cfg)
21 if err != nil {
22 log.Fatal(err)
23 }
24
25 t := template.Must(template.ParseGlob(filepath.Join(c.Dirs.Templates, "*")))
26
27 mux := routes.Handlers(c, t)
28 addr := fmt.Sprintf("%s:%d", c.Server.Host, c.Server.Port)
29 log.Println("starting server on", addr)
30 log.Fatal(http.ListenAndServe(addr, mux))
31}