Skip to content

Commit

Permalink
use the env config to replace the default value when connecting the etcd
Browse files Browse the repository at this point in the history
Signed-off-by: SimFG <bang.fu@zilliz.com>
  • Loading branch information
SimFG committed Aug 14, 2024
1 parent 86fc2df commit c613be6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions states/etcd_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,19 @@ func (s *disconnectState) getTLSConfig(cp *ConnectParams) (*tls.Config, error) {
}, nil
}

func (s *disconnectState) readEnv(cp *ConnectParams) {
if cp.EtcdAddr == "127.0.0.1:2379" && os.Getenv("MILVUS_ETCD_ADDR") != "" {
cp.EtcdAddr = os.Getenv("MILVUS_ETCD_ADDR")
fmt.Println("using env MILVUS_ETCD_ADDR,", cp.EtcdAddr)
}
if cp.RootPath == "by-dev" && os.Getenv("MILVUS_ROOT_PATH") != "" {
cp.RootPath = os.Getenv("MILVUS_ROOT_PATH")
fmt.Println("using env MILVUS_ROOT_PATH,", cp.RootPath)
}
}

func (s *disconnectState) ConnectCommand(ctx context.Context, cp *ConnectParams) error {
s.readEnv(cp)
tls, err := s.getTLSConfig(cp)
if err != nil {
return errors.Wrap(err, "failed to load tls certificates")
Expand Down

0 comments on commit c613be6

Please sign in to comment.