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.
44 lines
775 B
Go
44 lines
775 B
Go
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",
|
|
})
|
|
|
|
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"`)
|
|
}
|