sync the change from kubeedge in 2.20

Signed-off-by: wbc6080 <wangbincheng4@huawei.com>
This commit is contained in:
wbc6080 2024-02-20 14:57:59 +08:00
parent d886275726
commit 26e3ec2e41
3 changed files with 8 additions and 3 deletions

View File

@ -43,7 +43,7 @@ func main() {
go panel.DevStart()
// start http server
httpServer := httpserver.NewRestServer(panel)
httpServer := httpserver.NewRestServer(panel, c.Common.HTTPPort)
go httpServer.StartServer()
// start grpc server

View File

@ -44,6 +44,7 @@ type Common struct {
Protocol string `yaml:"protocol"`
Address string `yaml:"address"`
EdgeCoreSock string `yaml:"edgecore_sock"`
HTTPPort string `yaml:"http_port"`
}
// Parse the configuration file. If failed, return error.

View File

@ -30,10 +30,14 @@ type RestServer struct {
type Option func(server *RestServer)
func NewRestServer(devPanel global.DevPanel, options ...Option) *RestServer {
func NewRestServer(devPanel global.DevPanel, httpPort string, options ...Option) *RestServer {
if httpPort == "" {
httpPort = "7777"
}
rest := &RestServer{
IP: "0.0.0.0",
Port: "7777",
Port: httpPort,
Router: mux.NewRouter(),
WriteTimeout: 10 * time.Second,
ReadTimeout: 10 * time.Second,