2022-12-11 05:52:47 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
2022-12-12 17:28:23 +00:00
|
|
|
"fmt"
|
2022-12-11 05:52:47 +00:00
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
|
2022-12-19 03:32:23 +00:00
|
|
|
"git.icyphox.sh/legit/config"
|
|
|
|
"git.icyphox.sh/legit/routes"
|
2022-12-11 05:52:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var cfg string
|
|
|
|
flag.StringVar(&cfg, "config", "./config.yaml", "path to config file")
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
c, err := config.Read(cfg)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2022-12-18 05:34:11 +00:00
|
|
|
// for path := range []string{c.Dirs.Static, c.Repo.ScanPath, c.Dirs.Templates} {
|
|
|
|
// Unveil(path, "r")
|
|
|
|
// }
|
|
|
|
|
2022-12-11 05:52:47 +00:00
|
|
|
mux := routes.Handlers(c)
|
2022-12-12 17:28:23 +00:00
|
|
|
addr := fmt.Sprintf("%s:%d", c.Server.Host, c.Server.Port)
|
|
|
|
log.Println("starting server on", addr)
|
|
|
|
log.Fatal(http.ListenAndServe(addr, mux))
|
2022-12-11 05:52:47 +00:00
|
|
|
}
|