mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 18:59:57 +00:00
TUN-1968: Gracefully diff StreamHandler.UpdateConfig
This commit is contained in:
@@ -82,9 +82,16 @@ func (s *StreamHandler) UseConfiguration(ctx context.Context, config *pogs.Clien
|
||||
|
||||
// UpdateConfig replaces current originmapper mapping with mappings from newConfig
|
||||
func (s *StreamHandler) UpdateConfig(newConfig []*pogs.ReverseProxyConfig) (failedConfigs []*pogs.FailedConfig) {
|
||||
// TODO: TUN-1968: Gracefully apply new config
|
||||
s.tunnelHostnameMapper.DeleteAll()
|
||||
for _, tunnelConfig := range newConfig {
|
||||
|
||||
// Delete old configs that aren't in the `newConfig`
|
||||
toRemove := s.tunnelHostnameMapper.ToRemove(newConfig)
|
||||
for _, hostnameToRemove := range toRemove {
|
||||
s.tunnelHostnameMapper.Delete(hostnameToRemove)
|
||||
}
|
||||
|
||||
// Add new configs that weren't in the old mapper
|
||||
toAdd := s.tunnelHostnameMapper.ToAdd(newConfig)
|
||||
for _, tunnelConfig := range toAdd {
|
||||
tunnelHostname := tunnelConfig.TunnelHostname
|
||||
originSerice, err := tunnelConfig.OriginConfigJSONHandler.OriginConfig.Service()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user