-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
executable file
·54 lines (42 loc) · 1.1 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"github.com/khanakia/mangobp/apigql"
"github.com/khanakia/mangobp/mango/configmgr"
"github.com/khanakia/mangobp/mango/dbconn"
"github.com/khanakia/mangobp/mango/gormdb"
"github.com/khanakia/mangobp/mango/interfaces"
"github.com/khanakia/mangobp/mango/plug"
"github.com/khanakia/mangobp/wireapp"
"github.com/spf13/cobra"
"gorm.io/gorm"
)
func NewConfigMgrConfig() configmgr.Config {
return configmgr.Config{}
}
func NewInterfaceConfig(c *configmgr.ConfigMgr) interfaces.IConfig {
return c
}
func NewGormConfig(dbConn *dbconn.DbConn) gormdb.Config {
return gormdb.Config{
DB: dbConn.SqlDb,
}
}
func NewGormDb(gormdb gormdb.GormDB) *gorm.DB {
return gormdb.DB
}
func main() {
// USING WIRE
plugin := wireapp.Init()
plug.InitPlugins(plugin.Cli.RootCmd, plugin)
var ServerCommand = &cobra.Command{
Use: "server",
Short: "starts the HTTP server",
Run: func(cmd *cobra.Command, args []string) {
apigql.Boot(plugin)
//// Only wait if we do not start the http server
// plugin.Natso.Wait()
},
}
plugin.Cli.RootCmd.AddCommand(ServerCommand)
plugin.Cli.Execute()
}