You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
website/cmd/phc-website-server/main.go

48 lines
1.1 KiB
Go

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: "./storia.json",
},
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)
}
}