cscli.go 791 B

1234567891011121314151617181920212223242526272829
  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. if c.Prometheus.ListenAddr != "" && c.Prometheus.ListenPort != 0 {
  20. c.Cscli.PrometheusUrl = fmt.Sprintf("http://%s:%d/metrics", c.Prometheus.ListenAddr, c.Prometheus.ListenPort)
  21. }
  22. return nil
  23. }