zhenshan.cao bbfcbbdd68 Fix ci: paramstable and startup logic refactor
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
2021-02-23 11:40:30 +08:00

47 lines
715 B
Go

package grpcdataserviceclient
import (
"sync"
"github.com/zilliztech/milvus-distributed/internal/util/paramtable"
)
type ParamTable struct {
paramtable.BaseTable
Port int
MasterAddress string
}
var Params ParamTable
var once sync.Once
func (pt *ParamTable) Init() {
once.Do(func() {
pt.BaseTable.Init()
pt.initPort()
pt.initParams()
pt.LoadFromEnv()
})
}
func (pt *ParamTable) initParams() {
pt.initMasterAddress()
}
func (pt *ParamTable) LoadFromEnv() {
}
func (pt *ParamTable) initPort() {
pt.Port = pt.ParseInt("dataservice.port")
}
func (pt *ParamTable) initMasterAddress() {
ret, err := pt.Load("_MasterAddress")
if err != nil {
panic(err)
}
pt.MasterAddress = ret
}