config.go 871 B

1234567891011121314151617181920212223242526272829
  1. package config
  2. import (
  3. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/resource"
  4. "bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
  5. "github.com/zeromicro/go-zero/core/conf"
  6. "github.com/zeromicro/go-zero/core/discov"
  7. "github.com/zeromicro/go-zero/zrpc"
  8. )
  9. func init() {
  10. conf.MustLoad("etc/usercenter.yaml", &entity.ConfigJson)
  11. //初始化资源中台相关
  12. resourceClient := zrpc.MustNewClient(zrpc.RpcClientConf{
  13. Etcd: discov.EtcdConf{
  14. Hosts: entity.ConfigJson.ResourceEtcdConf.Etcd.Hosts,
  15. Key: entity.ConfigJson.ResourceEtcdConf.Etcd.Key,
  16. },
  17. })
  18. entity.ResourceLib = resource.NewResource(resourceClient)
  19. //菜单表 外网
  20. if entity.ConfigJson.WorkTableOut == "" {
  21. entity.ConfigJson.WorkTableOut = "work_menu"
  22. }
  23. //菜单表 内网
  24. if entity.ConfigJson.WorkTableInside == "" {
  25. entity.ConfigJson.WorkTableInside = "work_menu"
  26. }
  27. }