-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
47 lines (42 loc) · 1.71 KB
/
config.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
package golug_rest
import (
"encoding/json"
"time"
"github.com/gofiber/fiber/v2"
"github.com/pubgo/xerror"
)
const Name = "rest_entry"
type Cfg struct {
Prefork bool `json:"prefork"`
ServerHeader string `json:"server_header"`
StrictRouting bool `json:"strict_routing"`
CaseSensitive bool `json:"case_sensitive"`
Immutable bool `json:"immutable"`
UnescapePath bool `json:"unescape_path"`
ETag bool `json:"etag"`
BodyLimit int `json:"body_limit"`
Concurrency int `json:"concurrency"`
Templates struct {
Dir string `json:"dir"`
Ext string `json:"ext"`
} `json:"templates"`
ReadTimeout time.Duration `json:"read_timeout"`
WriteTimeout time.Duration `json:"write_timeout"`
IdleTimeout time.Duration `json:"idle_timeout"`
ReadBufferSize int `json:"read_buffer_size"`
WriteBufferSize int `json:"write_buffer_size"`
CompressedFileSuffix string `json:"compressed_file_suffix"`
ProxyHeader string `json:"proxy_header"`
GETOnly bool `json:"get_only"`
DisableKeepalive bool `json:"disable_keepalive"`
DisableDefaultDate bool `json:"disable_default_date"`
DisableDefaultContentType bool `json:"disable_default_content_type"`
DisableHeaderNormalizing bool `json:"disable_header_normalizing"`
DisableStartupMessage bool `json:"disable_startup_message"`
ReduceMemoryUsage bool `json:"reduce_memory_usage"`
}
func GetDefaultCfg() (cfg Cfg) {
dt := xerror.PanicBytes(json.Marshal(fiber.New().Config()))
xerror.Panic(json.Unmarshal(dt, &cfg))
return cfg
}