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

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