diff --git a/internal/server/handlers.go b/internal/server/handlers.go index ec0904c..d57b492 100644 --- a/internal/server/handlers.go +++ b/internal/server/handlers.go @@ -48,9 +48,16 @@ func (s *Server) ProcessChange(messages <-chan events.Message[events.ChangeMessa continue } } else { + loc := s.GetLocation(m.AdditionalSubjectIDs) + lb = &loadbalancer.LoadBalancer{ LoadBalancerID: m.SubjectID, LbType: loadbalancer.TypeLB, + LbData: &lbapi.LoadBalancer{ + Location: lbapi.LocationNode{ + ID: loc.String(), + }, + }, } } @@ -98,3 +105,13 @@ func (s *Server) LocationCheck(i gidx.PrefixedID) bool { return false } + +func (s *Server) GetLocation(subjs []gidx.PrefixedID) gidx.PrefixedID { + for _, subj := range subjs { + if s.LocationCheck(subj) { + return subj + } + } + + return gidx.PrefixedID("") +} diff --git a/loadbalancer-provider-haproxy b/loadbalancer-provider-haproxy deleted file mode 100755 index 8fde2d8..0000000 Binary files a/loadbalancer-provider-haproxy and /dev/null differ