houston server config 오버라이드
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"net"
|
||||
|
||||
"repositories.action2quare.com/ayo/gocommon"
|
||||
"repositories.action2quare.com/ayo/gocommon/flagx"
|
||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||
"repositories.action2quare.com/ayo/houston/shared"
|
||||
"repositories.action2quare.com/ayo/houston/shared/protos"
|
||||
@ -20,9 +21,8 @@ type HoustonServer interface {
|
||||
}
|
||||
|
||||
type serverConfig struct {
|
||||
GrpcPort int `json:"grpc_port"`
|
||||
StorageRoot string `json:"storage_path"`
|
||||
MaingateApiToken string `json:"maingate_api_token"`
|
||||
GrpcPort int `json:"grpc_port"`
|
||||
StorageRoot string `json:"storage_path"`
|
||||
}
|
||||
|
||||
type DeployRequest struct {
|
||||
@ -109,11 +109,14 @@ type Operation interface {
|
||||
}
|
||||
|
||||
type outerconfig struct {
|
||||
Houston *struct {
|
||||
Houston struct {
|
||||
Server serverConfig `json:"server"`
|
||||
} `json:"houston"`
|
||||
}
|
||||
|
||||
var storagePath = flagx.String("hs_storage", "", "")
|
||||
var grpcPort = flagx.Int("hs_grpc_port", 0, "")
|
||||
|
||||
func loadServerConfig() serverConfig {
|
||||
var oc outerconfig
|
||||
err := gocommon.LoadConfig[outerconfig](&oc)
|
||||
@ -124,6 +127,15 @@ func loadServerConfig() serverConfig {
|
||||
}
|
||||
}
|
||||
|
||||
if len(*storagePath) > 0 {
|
||||
// override
|
||||
oc.Houston.Server.StorageRoot = *storagePath
|
||||
}
|
||||
|
||||
if *grpcPort != 0 {
|
||||
oc.Houston.Server.GrpcPort = *grpcPort
|
||||
}
|
||||
|
||||
return oc.Houston.Server
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user