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

43 lines
1018 B
Go

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/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.JsonFileListUtenti{
Path: "./utenti-poisson-2022.local.json",
},
Storia: &website.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)
}
}