cscli.go 857 B

12345678910111213141516171819202122232425262728293031
  1. package csconfig
  2. import (
  3. "fmt"
  4. )
  5. /*cscli specific config, such as hub directory*/
  6. type CscliCfg struct {
  7. Output string `yaml:"output,omitempty"`
  8. Color string `yaml:"color,omitempty"`
  9. HubBranch string `yaml:"hub_branch"`
  10. SimulationConfig *SimulationConfig `yaml:"-"`
  11. DbConfig *DatabaseCfg `yaml:"-"`
  12. SimulationFilePath string `yaml:"-"`
  13. PrometheusUrl string `yaml:"prometheus_uri"`
  14. }
  15. func (c *Config) loadCSCLI() error {
  16. if c.Cscli == nil {
  17. c.Cscli = &CscliCfg{}
  18. }
  19. // XXX: HubBranch default should be set here and fed to HubCfg?
  20. if c.Prometheus.ListenAddr != "" && c.Prometheus.ListenPort != 0 {
  21. c.Cscli.PrometheusUrl = fmt.Sprintf("http://%s:%d/metrics", c.Prometheus.ListenAddr, c.Prometheus.ListenPort)
  22. }
  23. return nil
  24. }