|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"git.phc.dm.unipi.it/phc/website"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/articles"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/auth"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/config"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/handler"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/server"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/storia"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/templates"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
config.Load()
|
|
|
|
|
|
|
|
h := &handler.DefaultHandler{
|
|
|
|
AuthService: auth.NewDefaultService(config.AuthServiceHost),
|
|
|
|
Renderer: templates.NewRenderer(
|
|
|
|
"./_views/",
|
|
|
|
"./_views/base.html",
|
|
|
|
"./_views/partials/*.html",
|
|
|
|
),
|
|
|
|
NewsArticlesRegistry: articles.NewRegistry("./_content/news"),
|
|
|
|
GuideArticlesRegistry: articles.NewRegistry("./_content/guide"),
|
|
|
|
ListaUtenti: &website.JsonFileListaUtenti{
|
|
|
|
Path: "./utenti-poisson-2022.local.json",
|
|
|
|
},
|
|
|
|
Storia: &storia.JsonFileStoria{
|
|
|
|
Path: "./storia.json",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
app := server.NewFiberServer(h)
|
|
|
|
|
|
|
|
log.Printf("Starting server on host %q", config.Host)
|
|
|
|
err := app.Listen(config.Host)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|