Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd95b8d8b1 | ||
|
|
dd9a692858 | ||
|
|
b5374b85ff |
@@ -7,6 +7,7 @@ type Base struct {
|
|||||||
SecretKey string `yaml:"SecretKey"` // 服务秘钥
|
SecretKey string `yaml:"SecretKey"` // 服务秘钥
|
||||||
BindIP string `yaml:"BindIP"` // 绑定IP
|
BindIP string `yaml:"BindIP"` // 绑定IP
|
||||||
Addr string `yaml:"Addr"`
|
Addr string `yaml:"Addr"`
|
||||||
|
OnMicroService bool `yaml:"OnMicroService"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DBConf struct {
|
type DBConf struct {
|
||||||
@@ -48,11 +49,14 @@ type RpcConf struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OssConf struct {
|
type OssConf struct {
|
||||||
|
Platform string `yaml:"Platform"` // oss平台:aliyun,tencent,huawei,aws,minio
|
||||||
Site string `yaml:"Site"` // oss站点HOST
|
Site string `yaml:"Site"` // oss站点HOST
|
||||||
Endpoint string `yaml:"Endpoint"` // oss服务接入地址
|
Endpoint string `yaml:"Endpoint"` // oss服务接入地址
|
||||||
Region string `yaml:"Region"` // oss服务区域
|
Region string `yaml:"Region"` // oss服务区域
|
||||||
AccessKeyID string `yaml:"AccessKeyId"` // oss AccessKeyId
|
AccessKeyID string `yaml:"AccessKeyId"` // oss AccessKeyId
|
||||||
AccessKeySecret string `yaml:"AccessKeySecret"` // oss AccessKeySecret
|
AccessKeySecret string `yaml:"AccessKeySecret"` // oss AccessKeySecret
|
||||||
|
UseSSL bool `yaml:"UseSSL"` // 是否使用SSL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type MqConf struct {
|
type MqConf struct {
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ var (
|
|||||||
|
|
||||||
type service struct{}
|
type service struct{}
|
||||||
|
|
||||||
func (s *service) Register(cli *clientv3.Client, serviceName string, port int) error {
|
func (s *service) Register(cli *clientv3.Client, serviceName string, port string) error {
|
||||||
lease := clientv3.NewLease(cli)
|
lease := clientv3.NewLease(cli)
|
||||||
grantResp, err := lease.Grant(context.TODO(), 5)
|
grantResp, err := lease.Grant(context.TODO(), 5)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
serviceAddr := utils.GetLocationIP() + ":" + utils.Int2String(port)
|
serviceAddr := utils.GetLocationIP() + ":" + port
|
||||||
|
|
||||||
key := RootPrefix + serviceName + "/" + utils.Int642String(time.Now().UnixNano())
|
key := RootPrefix + serviceName + "/" + utils.Int642String(time.Now().UnixNano())
|
||||||
_, err = cli.KV.Put(context.TODO(), key, serviceAddr, clientv3.WithLease(grantResp.ID))
|
_, err = cli.KV.Put(context.TODO(), key, serviceAddr, clientv3.WithLease(grantResp.ID))
|
||||||
|
|||||||
Reference in New Issue
Block a user