-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathweb.go
More file actions
34 lines (26 loc) · 721 Bytes
/
web.go
File metadata and controls
34 lines (26 loc) · 721 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
package internal
import (
"net/http"
"github.com/cloudslit/cfssl/ocsp"
"github.com/cloudslit/deca/internal/api"
"github.com/cloudslit/deca/internal/middleware"
"github.com/gin-gonic/gin"
"github.com/cloudslit/deca/internal/config"
"github.com/cloudslit/deca/internal/router"
)
func InitGinEngine(r router.IRouter) *gin.Engine {
gin.SetMode(config.C.RunMode)
app := gin.New()
app.NoMethod(middleware.NoMethodHandler())
app.NoRoute(middleware.NoRouteHandler())
// Recover
app.Use(middleware.RecoveryMiddleware())
// Router register
r.Register(app)
return app
}
func InitOcspEngine(r *api.OcspAPI) *http.ServeMux {
mux := http.NewServeMux()
mux.Handle("/", ocsp.NewResponder(r, nil))
return mux
}