diff --git a/agent/cmd/server/conf/app.yaml b/agent/cmd/server/conf/app.yaml index 0c57556fa..20dcbb622 100644 --- a/agent/cmd/server/conf/app.yaml +++ b/agent/cmd/server/conf/app.yaml @@ -1,6 +1,7 @@ base: install_dir: /opt mode: dev + is_demo: false remote_url: app_repo: https://apps-assets.fit2cloud.com diff --git a/agent/init/viper/viper.go b/agent/init/viper/viper.go index 7b5dfcead..f1f77cdb4 100644 --- a/agent/init/viper/viper.go +++ b/agent/init/viper/viper.go @@ -50,7 +50,6 @@ func Init() { } global.CONF = serverConfig - global.CONF.Base.IsDemo = v.GetBool("system.is_demo") initBaseInfo() global.Viper = v diff --git a/core/app/api/v2/host.go b/core/app/api/v2/host.go index 9bcee15d3..33312855d 100644 --- a/core/app/api/v2/host.go +++ b/core/app/api/v2/host.go @@ -276,6 +276,12 @@ func (b *BaseApi) WsSsh(c *gin.Context) { } defer wsConn.Close() + if global.CONF.Base.IsDemo { + if wshandleError(wsConn, errors.New(" demo server, prohibit this operation!")) { + return + } + } + id, err := strconv.Atoi(c.Query("id")) if wshandleError(wsConn, errors.WithMessage(err, "invalid param id in request")) { return