Rainbond/gateway/controller/openresty/model/http.go

87 lines
1.6 KiB
Go
Raw Normal View History

2018-11-08 17:22:26 +08:00
package model
2018-11-21 17:35:07 +08:00
import "github.com/goodrain/rainbond/cmd/gateway/option"
2018-11-23 14:34:44 +08:00
// HTTP contains data for nginx http configuration
type HTTP struct {
2018-11-08 17:22:26 +08:00
DefaultType string
SendFile bool
KeepaliveTimeout Time
2018-11-21 17:35:07 +08:00
keepaliveRequests int
2018-11-08 17:22:26 +08:00
ClientMaxBodySize Size
ClientBodyBufferSize Size
ProxyConnectTimeout Time
ProxySendTimeout Time
ProxyReadTimeout Time
ProxyBufferSize Size
ProxyBuffers Size
ProxyBusyBuffersSize Size
2018-12-05 22:06:21 +08:00
StatusPort int
2018-11-23 14:34:44 +08:00
UpstreamsDict Size
HTTPListen int
HTTPSListen int
AccessLogPath string
DisableAccessLog bool
2018-11-08 17:22:26 +08:00
}
2019-03-10 18:51:10 +08:00
// LogFormat -
2018-11-08 17:22:26 +08:00
type LogFormat struct {
Name string
Format string
}
2019-03-10 18:51:10 +08:00
// AccessLog -
2018-11-08 17:22:26 +08:00
type AccessLog struct {
Name string
Path string
}
2018-11-23 14:34:44 +08:00
// NewHTTP creates a new model.HTTP
func NewHTTP(conf *option.Config) *HTTP {
return &HTTP{
HTTPListen: conf.ListenPorts.HTTP,
HTTPSListen: conf.ListenPorts.HTTPS,
DefaultType: "text/html",
SendFile: true,
StatusPort: conf.ListenPorts.Status,
AccessLogPath: conf.AccessLogPath,
DisableAccessLog: conf.AccessLogPath == "",
2018-11-08 17:22:26 +08:00
KeepaliveTimeout: Time{
Num: 30,
2018-11-08 17:22:26 +08:00
Unit: "s",
},
ClientMaxBodySize: Size{
Num: 10,
Unit: "m",
},
ClientBodyBufferSize: Size{
Num: 128,
Unit: "k",
},
ProxyConnectTimeout: Time{
Num: 75,
Unit: "s",
},
ProxySendTimeout: Time{
Num: 75,
Unit: "s",
},
ProxyReadTimeout: Time{
Num: 75,
Unit: "s",
},
ProxyBufferSize: Size{
Num: 8,
Unit: "k",
},
ProxyBuffers: Size{
Num: 32,
Unit: "k",
},
2018-11-23 14:34:44 +08:00
UpstreamsDict: Size{
Num: int(conf.ShareMemory),
Unit: "m",
2018-11-23 14:34:44 +08:00
},
2018-11-08 17:22:26 +08:00
}
}