|
@ -28,17 +28,17 @@ func main() { |
|
|
log.Fatalln("Failed to init store:", err) |
|
|
log.Fatalln("Failed to init store:", err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
repos, stopFn, err := database.Init(config.Global().Database) |
|
|
|
|
|
|
|
|
db, err := database.Init(config.Global().Database) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Fatalln("Failed to init db:", err) |
|
|
log.Fatalln("Failed to init db:", err) |
|
|
} |
|
|
} |
|
|
defer stopFn() |
|
|
|
|
|
services := services.NewBundle(repos) |
|
|
|
|
|
|
|
|
defer db.Close(context.Background()) |
|
|
|
|
|
serviceBundle := services.NewBundle(db) |
|
|
|
|
|
|
|
|
instrumentation.Register() |
|
|
instrumentation.Register() |
|
|
|
|
|
|
|
|
http.Handle("/", handler.Playground("RPData API", "/graphql")) |
|
|
http.Handle("/", handler.Playground("RPData API", "/graphql")) |
|
|
http.Handle("/graphql", queryHandler(services)) |
|
|
|
|
|
|
|
|
http.Handle("/graphql", queryHandler(serviceBundle)) |
|
|
|
|
|
|
|
|
http.Handle("/metrics", promhttp.Handler()) |
|
|
http.Handle("/metrics", promhttp.Handler()) |
|
|
|
|
|
|
|
@ -51,7 +51,7 @@ func main() { |
|
|
log.Println("Characters updated") |
|
|
log.Println("Characters updated") |
|
|
}() |
|
|
}() |
|
|
|
|
|
|
|
|
go logListedChanges(services.Changes) |
|
|
|
|
|
|
|
|
go logListedChanges(serviceBundle.Changes) |
|
|
|
|
|
|
|
|
log.Fatal(http.ListenAndServe(":8081", nil)) |
|
|
log.Fatal(http.ListenAndServe(":8081", nil)) |
|
|
} |
|
|
} |
|
|