Files
isp-gate-service/routing/routing.go
T
2019-11-15 13:27:34 +03:00

29 lines
648 B
Go

package routing
import (
"github.com/integration-system/isp-lib/structure"
)
var (
InnerMethods = make(map[string]bool)
AllMethods = make(map[string]bool)
)
func InitRoutes(configs structure.RoutingConfig) {
newAddressMap := make(map[string]bool)
newInnerAddressMap := make(map[string]bool)
for _, backend := range configs {
if backend.Address.IP == "" || backend.Address.Port == "" || len(backend.Endpoints) == 0 {
continue
}
for _, v := range backend.Endpoints {
newAddressMap[v.Path] = true
if v.Inner {
newInnerAddressMap[v.Path] = true
}
}
}
AllMethods = newAddressMap
InnerMethods = newInnerAddressMap
}