@@ -2,6 +2,11 @@ package options
22
33import "time"
44
5+const (
6+ // DefaultUpstreamFlushInterval is the default value for the Upstream FlushInterval.
7+ DefaultUpstreamFlushInterval = 1 * time.Second
8+)
9+
510// Upstreams is a collection of definitions for upstream servers.
611type Upstreams []Upstream
712
@@ -10,11 +15,11 @@ type Upstreams []Upstream
1015type Upstream struct {
1116 // ID should be a unique identifier for the upstream.
1217 // This value is required for all upstreams.
13− ID string `json:"id"`
18+ ID string `json:"id,omitempty"`
1419
1520 // Path is used to map requests to the upstream server.
1621 // The closest match will take precedence and all Paths must be unique.
17− Path string `json:"path"`
22+ Path string `json:"path,omitempty"`
1823
1924 // The URI of the upstream server. This may be an HTTP(S) server of a File
2025 // based URL. It may include a path, in which case all requests will be served
@@ -26,19 +31,19 @@ type Upstream struct {
2631 // - file://host/path
2732 // If the URI's path is "/base" and the incoming request was for "/dir",
2833 // the upstream request will be for "/base/dir".
29− URI string `json:"uri"`
34+ URI string `json:"uri,omitempty"`
3035
3136 // InsecureSkipTLSVerify will skip TLS verification of upstream HTTPS hosts.
3237 // This option is insecure and will allow potential Man-In-The-Middle attacks
3338 // betweem OAuth2 Proxy and the usptream server.
3439 // Defaults to false.
35− InsecureSkipTLSVerify bool `json:"insecureSkipTLSVerify"`
40+ InsecureSkipTLSVerify bool `json:"insecureSkipTLSVerify,omitempty"`
3641
3742 // Static will make all requests to this upstream have a static response.
3843 // The response will have a body of "Authenticated" and a response code
3944 // matching StaticCode.
4045 // If StaticCode is not set, the response will return a 200 response.
41− Static bool `json:"static"`
46+ Static bool `json:"static,omitempty"`
4247
4348 // StaticCode determines the response code for the Static response.
4449 // This option can only be used with Static enabled.
@@ -47,14 +52,14 @@ type Upstream struct {
4752 // FlushInterval is the period between flushing the response buffer when
4853 // streaming response from the upstream.
4954 // Defaults to 1 second.
50− FlushInterval *time.Duration `json:"flushInterval,omitempty"`
55+ FlushInterval *Duration `json:"flushInterval,omitempty"`
5156
5257 // PassHostHeader determines whether the request host header should be proxied
5358 // to the upstream server.
5459 // Defaults to true.
55− PassHostHeader *bool `json:"passHostHeader"`
60+ PassHostHeader *bool `json:"passHostHeader,omitempty"`
5661
5762 // ProxyWebSockets enables proxying of websockets to upstream servers
5863 // Defaults to true.
59− ProxyWebSockets *bool `json:"proxyWebSockets"`
64+ ProxyWebSockets *bool `json:"proxyWebSockets,omitempty"`
6065}