options.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package options
  15. import common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
  16. var (
  17. Options WebConsoleOptions
  18. )
  19. type WebConsoleOptions struct {
  20. common_options.CommonOptions
  21. common_options.DBOptions
  22. KubectlPath string `help:"kubectl binary path used to connect k8s cluster" default:"/usr/bin/kubectl"`
  23. AdbPath string `help:"adb binary path" default:"/usr/bin/adb"`
  24. IpmitoolPath string `help:"ipmitool binary path used to connect baremetal sol" default:"/usr/bin/ipmitool"`
  25. EnableAutoLogin bool `help:"allow webconsole to log in directly with the cloudroot public key" default:"false"`
  26. ApsaraConsoleAddr string `help:"Apsara console addr" default:"https://xxxx.com.cn/module/ecs/vnc/index.html"`
  27. AliyunConsoleAddr string `help:"Aliyun vnc addr" default:"https://g.alicdn.com/aliyun/ecs-console-vnc2/0.0.8/index.html"`
  28. SshSessionTimeoutMinutes int `help:"ssh timeout session" default:"-1"`
  29. RdpSessionTimeoutMinutes int `help:"rdp timeout session" default:"-1"`
  30. EnableWatermark bool `help:"enable water mark" default:"false"`
  31. EnableCommandRecording bool `help:"enable command recording" default:"false"`
  32. KeepWebsocketSession bool `help:"keep websocket session" default:"false"`
  33. RefererWhitelist []string `help:"referer whitelist" default:"skip_check"`
  34. }
  35. func OnOptionsChange(oldO, newO interface{}) bool {
  36. oldOpts := oldO.(*WebConsoleOptions)
  37. newOpts := newO.(*WebConsoleOptions)
  38. changed := false
  39. if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
  40. changed = true
  41. }
  42. if common_options.OnDBOptionsChange(&oldOpts.DBOptions, &newOpts.DBOptions) {
  43. changed = true
  44. }
  45. return changed
  46. }