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.
45 lines
876 B
Go
45 lines
876 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
"os"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/services/config"
|
|
"git.phc.dm.unipi.it/phc/website/services/database"
|
|
"git.phc.dm.unipi.it/phc/website/services/server"
|
|
"git.phc.dm.unipi.it/phc/website/services/server/dev"
|
|
"git.phc.dm.unipi.it/phc/website/sl"
|
|
)
|
|
|
|
func main() {
|
|
l := sl.New()
|
|
|
|
// sl.Inject[config.Interface](l, &config.EnvConfig{})
|
|
|
|
sl.InjectValue(l, config.Slot, &config.Config{
|
|
Mode: "production",
|
|
})
|
|
|
|
sl.InjectValue(l, database.Slot, database.Database(
|
|
&database.Memory{}),
|
|
)
|
|
|
|
if _, err := server.Configure(l); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
f, err := os.Create("out/routes.json")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
enc := json.NewEncoder(f)
|
|
enc.SetIndent("", " ")
|
|
if err := enc.Encode(dev.UseRoutesMetadata(l)); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
log.Printf(`generated "out/routes.json"`)
|
|
}
|