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

44 lines
1.1 KiB
Go

2 years ago
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/server"
"git.phc.dm.unipi.it/phc/website/storia"
2 years ago
"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",
2 years ago
),
NewsArticlesRegistry: articles.NewRegistry("./_content/news"),
GuideArticlesRegistry: articles.NewRegistry("./_content/guide"),
// ListaUtenti: &website.JsonFileListaUtenti{
// Path: "./utenti-poisson-2022.local.json",
// },
ListaUtentiService: auth.NewLDAPAuthService(config.AuthServiceHost),
Storia: &storia.JsonFileStoria{
2 years ago
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)
}
}