|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"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/lista_utenti"
|
|
|
|
"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()
|
|
|
|
|
|
|
|
authService := auth.NewDefaultService(config.AuthServiceHost)
|
|
|
|
|
|
|
|
listaUtentiService, err := lista_utenti.New(authService, config.ListaUtenti)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
h := &handler.DefaultHandler{
|
|
|
|
AuthService: authService,
|
|
|
|
Renderer: templates.NewRenderer(
|
|
|
|
"./_views/",
|
|
|
|
"./_views/base.html",
|
|
|
|
"./_views/partials/*.html",
|
|
|
|
),
|
|
|
|
NewsArticlesRegistry: articles.NewRegistry("./_content/news"),
|
|
|
|
GuideArticlesRegistry: articles.NewRegistry("./_content/guide"),
|
|
|
|
Storia: &storia.JsonFileStoria{
|
|
|
|
Path: "./_content/storia.yaml",
|
|
|
|
},
|
|
|
|
ListaUtenti: listaUtentiService,
|
|
|
|
}
|
|
|
|
|
|
|
|
app := server.NewFiberServer(h)
|
|
|
|
|
|
|
|
log.Printf("Starting server on host %q", config.Host)
|
|
|
|
if err := app.Listen(config.Host); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|