2020-04-30 02:03:05 +00:00
|
|
|
package schema
|
|
|
|
|
2022-08-08 21:50:12 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2020-04-30 02:03:05 +00:00
|
|
|
// ServerConfiguration represents the configuration of the http server.
|
|
|
|
type ServerConfiguration struct {
|
2021-08-05 04:02:07 +00:00
|
|
|
Host string `koanf:"host"`
|
|
|
|
Port int `koanf:"port"`
|
|
|
|
Path string `koanf:"path"`
|
2021-11-15 08:37:58 +00:00
|
|
|
AssetPath string `koanf:"asset_path"`
|
2022-03-28 02:06:31 +00:00
|
|
|
EnablePprof bool `koanf:"enable_pprof"`
|
|
|
|
EnableExpvars bool `koanf:"enable_expvars"`
|
2021-08-05 04:02:07 +00:00
|
|
|
DisableHealthcheck bool `koanf:"disable_healthcheck"`
|
2021-08-02 11:55:30 +00:00
|
|
|
|
2022-02-20 23:14:09 +00:00
|
|
|
TLS ServerTLSConfiguration `koanf:"tls"`
|
|
|
|
Headers ServerHeadersConfiguration `koanf:"headers"`
|
2022-08-08 21:50:12 +00:00
|
|
|
|
|
|
|
Buffers ServerBuffers `koanf:"buffers"`
|
|
|
|
Timeouts ServerTimeouts `koanf:"timeouts"`
|
2021-08-02 11:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ServerTLSConfiguration represents the configuration of the http servers TLS options.
|
|
|
|
type ServerTLSConfiguration struct {
|
2022-04-04 23:57:47 +00:00
|
|
|
Certificate string `koanf:"certificate"`
|
|
|
|
Key string `koanf:"key"`
|
|
|
|
ClientCertificates []string `koanf:"client_certificates"`
|
2020-04-30 02:03:05 +00:00
|
|
|
}
|
|
|
|
|
2022-02-20 23:14:09 +00:00
|
|
|
// ServerHeadersConfiguration represents the customization of the http server headers.
|
|
|
|
type ServerHeadersConfiguration struct {
|
|
|
|
CSPTemplate string `koanf:"csp_template"`
|
|
|
|
}
|
|
|
|
|
2020-04-30 02:03:05 +00:00
|
|
|
// DefaultServerConfiguration represents the default values of the ServerConfiguration.
|
|
|
|
var DefaultServerConfiguration = ServerConfiguration{
|
2022-08-08 21:50:12 +00:00
|
|
|
Host: "0.0.0.0",
|
|
|
|
Port: 9091,
|
|
|
|
Buffers: ServerBuffers{
|
|
|
|
Read: 4096,
|
|
|
|
Write: 4096,
|
|
|
|
},
|
|
|
|
Timeouts: ServerTimeouts{
|
2022-10-07 02:52:01 +00:00
|
|
|
Read: time.Second * 6,
|
|
|
|
Write: time.Second * 6,
|
2022-08-08 21:50:12 +00:00
|
|
|
Idle: time.Second * 30,
|
|
|
|
},
|
2020-04-30 02:03:05 +00:00
|
|
|
}
|