milvus/internal/distributed/proxyservice/paramtable.go
zhenshan.cao c2734fa55f Fix bug and enchance system
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
2021-03-22 16:36:10 +08:00

42 lines
683 B
Go

package grpcproxyservice
import (
"sync"
"github.com/zilliztech/milvus-distributed/internal/util/paramtable"
)
type ParamTable struct {
paramtable.BaseTable
ServiceAddress string
ServicePort int
}
var Params ParamTable
var once sync.Once
func (pt *ParamTable) Init() {
once.Do(func() {
pt.BaseTable.Init()
pt.initParams()
})
}
func (pt *ParamTable) initParams() {
pt.initServicePort()
pt.initServiceAddress()
}
func (pt *ParamTable) initServicePort() {
pt.ServicePort = pt.ParseInt("proxyService.port")
}
func (pt *ParamTable) initServiceAddress() {
ret, err := pt.Load("_PROXY_SERVICE_ADDRESS")
if err != nil {
panic(err)
}
pt.ServiceAddress = ret
}