init.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package rpc_apis_v1
  2. import (
  3. "gd_gateway/common.in/config"
  4. "gd_gateway/rpc_apis_v1/gd_access_log"
  5. "gd_gateway/rpc_apis_v1/gd_auth_check"
  6. "gd_gateway/rpc_apis_v1/gd_service"
  7. "gd_gateway/rpc_apis_v1/gd_vehicle"
  8. )
  9. var Vehicle *gd_vehicle.GdVehicleXClient
  10. var AuthCheck *gd_auth_check.GdAuthCheckXClient
  11. var AccessLog *gd_access_log.GdAccessLogXClient
  12. var Service *gd_service.GdServiceXClient
  13. func Init(etcdAddrs []string, conf *config.Configure) {
  14. Vehicle = &gd_vehicle.GdVehicleXClient{}
  15. Vehicle.Init(etcdAddrs, conf.Rpc.BasePath, conf.Rpc.Vehicle.Name)
  16. Service = &gd_service.GdServiceXClient{}
  17. Service.Init(etcdAddrs, conf.Rpc.BasePath, conf.Rpc.Service.Name)
  18. AuthCheck = &gd_auth_check.GdAuthCheckXClient{}
  19. AuthCheck.Init(etcdAddrs, conf.Rpc.BasePath, conf.Rpc.AuthCheck.Name)
  20. AccessLog = &gd_access_log.GdAccessLogXClient{}
  21. AccessLog.Init(etcdAddrs, conf.Rpc.BasePath, conf.Rpc.AccessLog.Name)
  22. }
  23. func InitForK8s(conf *config.Configure) {
  24. Vehicle = &gd_vehicle.GdVehicleXClient{}
  25. Vehicle.InitForK8s(conf.Rpc.Vehicle.Name, conf.Rpc.Vehicle.ServiceName, conf.Rpc.Vehicle.ServicePort.String())
  26. Service = &gd_service.GdServiceXClient{}
  27. Service.InitForK8s(conf.Rpc.Service.Name, conf.Rpc.Service.ServiceName, conf.Rpc.Service.ServicePort.String())
  28. AuthCheck = &gd_auth_check.GdAuthCheckXClient{}
  29. AuthCheck.InitForK8s(conf.Rpc.AuthCheck.Name, conf.Rpc.AuthCheck.ServiceName, conf.Rpc.AuthCheck.ServicePort.String())
  30. AccessLog = &gd_access_log.GdAccessLogXClient{}
  31. AccessLog.InitForK8s(conf.Rpc.AccessLog.Name, conf.Rpc.AccessLog.ServiceName, conf.Rpc.AccessLog.ServicePort.String())
  32. }