서버와 클라이언트 동시에 구동하는 옵션 추가
This commit is contained in:
@ -5,8 +5,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||||
|
"repositories.action2quare.com/ayo/houston/client"
|
||||||
"repositories.action2quare.com/ayo/houston/shared"
|
"repositories.action2quare.com/ayo/houston/shared"
|
||||||
"repositories.action2quare.com/ayo/houston/shared/protos"
|
"repositories.action2quare.com/ayo/houston/shared/protos"
|
||||||
|
|
||||||
@ -23,6 +25,7 @@ type HoustonServer interface {
|
|||||||
type serverConfig struct {
|
type serverConfig struct {
|
||||||
GrpcPort int `json:"grpc_port"`
|
GrpcPort int `json:"grpc_port"`
|
||||||
StorageRoot string `json:"storage_path"`
|
StorageRoot string `json:"storage_path"`
|
||||||
|
RunAsClient bool `json:"run_as_client"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeployRequest struct {
|
type DeployRequest struct {
|
||||||
@ -173,6 +176,18 @@ func (hs *houstonServer) Start() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if loadServerConfig().RunAsClient {
|
||||||
|
go func() {
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
hc, err := client.NewClient()
|
||||||
|
if err != nil {
|
||||||
|
logger.Fatal(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hc.Start()
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
if err := hs.rpcServer.Serve(lis); err != nil {
|
if err := hs.rpcServer.Serve(lis); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user