TUN-6860: Send access configuration keys to the edge
This commit is contained in:
parent
b01006fe46
commit
61007dd2dd
|
@ -427,6 +427,12 @@ func (defaults *OriginRequestConfig) setHttp2Origin(overrides config.OriginReque
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (defaults *OriginRequestConfig) setAccess(overrides config.OriginRequestConfig) {
|
||||||
|
if val := overrides.Access; val != nil {
|
||||||
|
defaults.Access = *val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SetConfig gets config for the requests that cloudflared sends to origins.
|
// SetConfig gets config for the requests that cloudflared sends to origins.
|
||||||
// Each field has a setter method which sets a value for the field by trying to find:
|
// Each field has a setter method which sets a value for the field by trying to find:
|
||||||
// 1. The user config for this rule
|
// 1. The user config for this rule
|
||||||
|
@ -453,6 +459,8 @@ func setConfig(defaults OriginRequestConfig, overrides config.OriginRequestConfi
|
||||||
cfg.setProxyType(overrides)
|
cfg.setProxyType(overrides)
|
||||||
cfg.setIPRules(overrides)
|
cfg.setIPRules(overrides)
|
||||||
cfg.setHttp2Origin(overrides)
|
cfg.setHttp2Origin(overrides)
|
||||||
|
cfg.setAccess(overrides)
|
||||||
|
|
||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,6 +471,7 @@ func ConvertToRawOriginConfig(c OriginRequestConfig) config.OriginRequestConfig
|
||||||
var keepAliveConnections *int
|
var keepAliveConnections *int
|
||||||
var keepAliveTimeout *config.CustomDuration
|
var keepAliveTimeout *config.CustomDuration
|
||||||
var proxyAddress *string
|
var proxyAddress *string
|
||||||
|
var access *config.AccessConfig
|
||||||
|
|
||||||
if c.ConnectTimeout != defaultHTTPConnectTimeout {
|
if c.ConnectTimeout != defaultHTTPConnectTimeout {
|
||||||
connectTimeout = &c.ConnectTimeout
|
connectTimeout = &c.ConnectTimeout
|
||||||
|
@ -482,6 +491,9 @@ func ConvertToRawOriginConfig(c OriginRequestConfig) config.OriginRequestConfig
|
||||||
if c.ProxyAddress != defaultProxyAddress {
|
if c.ProxyAddress != defaultProxyAddress {
|
||||||
proxyAddress = &c.ProxyAddress
|
proxyAddress = &c.ProxyAddress
|
||||||
}
|
}
|
||||||
|
if c.Access.Required {
|
||||||
|
access = &c.Access
|
||||||
|
}
|
||||||
|
|
||||||
return config.OriginRequestConfig{
|
return config.OriginRequestConfig{
|
||||||
ConnectTimeout: connectTimeout,
|
ConnectTimeout: connectTimeout,
|
||||||
|
@ -501,6 +513,7 @@ func ConvertToRawOriginConfig(c OriginRequestConfig) config.OriginRequestConfig
|
||||||
ProxyType: emptyStringToNil(c.ProxyType),
|
ProxyType: emptyStringToNil(c.ProxyType),
|
||||||
IPRules: convertToRawIPRules(c.IPRules),
|
IPRules: convertToRawIPRules(c.IPRules),
|
||||||
Http2Origin: defaultBoolToNil(c.Http2Origin),
|
Http2Origin: defaultBoolToNil(c.Http2Origin),
|
||||||
|
Access: access,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue