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/build/main.go

44 lines
775 B
Go

2 years ago
package main
import (
"encoding/json"
"log"
"os"
"phc/website/services/config"
"phc/website/services/database"
"phc/website/services/server"
"phc/website/services/server/dev"
"phc/website/sl"
)
func main() {
l := sl.New()
// sl.Inject[config.Interface](l, &config.EnvConfig{})
sl.InjectValue(l, config.Slot, &config.Config{
Mode: "production",
2 years ago
})
sl.InjectValue(l, database.Slot, database.Database(
&database.Memory{}),
)
2 years ago
if _, err := server.Configure(l); err != nil {
2 years ago
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 {
2 years ago
log.Fatal(err)
}
log.Printf(`generated "out/routes.json"`)
2 years ago
}