-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.go
More file actions
42 lines (32 loc) · 954 Bytes
/
main.go
File metadata and controls
42 lines (32 loc) · 954 Bytes
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
package main
import (
"log"
"net/http"
"os"
"github.com/labstack/echo/v4"
"gitlab.com/promptech1/infuser-gateway/client"
"gitlab.com/promptech1/infuser-gateway/config"
"gitlab.com/promptech1/infuser-gateway/handler"
"gitlab.com/promptech1/infuser-gateway/router"
)
func main() {
ballast := make([]byte, 10<<24)
_ = ballast
conf := new(config.Config)
if err := conf.InitConf(); err != nil {
log.Printf("Fail load config: %s", err.Error())
os.Exit(-1)
}
grpcAuthorPool := client.NewGRPCAuthorPool(conf)
grpcExecutorPool := client.NewGRPCExecutorPool(conf)
r := router.New()
r.HEAD("/hc", func(c echo.Context) error {
return c.String(http.StatusOK, "OpenAPI Data Service")
})
h := handler.NewHandler(grpcAuthorPool, grpcExecutorPool, conf)
authGroup := r.Group("/auth")
h.RegisterAuth(authGroup)
apiGroup := r.Group("/api")
h.RegisterApi(apiGroup)
r.Logger.Fatal(r.Start(conf.Server.Host + ":" + conf.Server.Port))
}