2020-04-10 08:27:43 +02:00
|
|
|
package serv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/dosco/super-graph/core"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
sg *core.SuperGraph
|
|
|
|
)
|
|
|
|
|
|
|
|
func cmdServ(cmd *cobra.Command, args []string) {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
conf, err = initConf()
|
|
|
|
if err != nil {
|
|
|
|
fatalInProd(err, "failed to read config")
|
|
|
|
}
|
|
|
|
|
|
|
|
initWatcher()
|
|
|
|
|
|
|
|
db, err = initDB(conf)
|
|
|
|
if err != nil {
|
|
|
|
fatalInProd(err, "failed to connect to database")
|
|
|
|
}
|
|
|
|
|
|
|
|
// if conf != nil && db != nil {
|
|
|
|
// initResolvers()
|
|
|
|
// }
|
|
|
|
|
2020-04-11 08:45:06 +02:00
|
|
|
sg, err = core.NewSuperGraph(&conf.Core, db)
|
2020-04-10 08:27:43 +02:00
|
|
|
if err != nil {
|
|
|
|
fatalInProd(err, "failed to initialize Super Graph")
|
|
|
|
}
|
|
|
|
|
|
|
|
startHTTP()
|
|
|
|
}
|