-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp.go
52 lines (50 loc) · 1.26 KB
/
http.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
package config
import (
"github.com/gin-gonic/gin/render"
"github.com/goravel/framework/contracts/route"
"github.com/goravel/framework/facades"
"github.com/goravel/gin"
ginfacades "github.com/goravel/gin/facades"
)
func init() {
config := facades.Config()
config.Add("http", map[string]any{
// HTTP Driver
"default": "gin",
// HTTP Drivers
"drivers": map[string]any{
"gin": map[string]any{
// Optional, default is 4096 KB
"body_limit": 4096,
"header_limit": 4096,
"route": func() (route.Route, error) {
return ginfacades.Route("gin"), nil
},
// Optional, default is http/template
"template": func() (render.HTMLRender, error) {
return gin.DefaultTemplate()
},
},
},
// HTTP URL
"url": config.Env("APP_URL", "http://localhost"),
// HTTP Host
"host": config.Env("APP_HOST", "127.0.0.1"),
// HTTP Port
"port": config.Env("APP_PORT", "3000"),
// HTTPS Configuration
"tls": map[string]any{
// HTTPS Host
"host": config.Env("APP_HOST", "127.0.0.1"),
// HTTPS Port
"port": config.Env("APP_PORT", "3000"),
// SSL Certificate, you can put the certificate in /public folder
"ssl": map[string]any{
// ca.pem
"cert": "",
// ca.key
"key": "",
},
},
})
}