config.go 908 B

12345678910111213141516171819202122232425262728293031
  1. package costmodel
  2. import (
  3. "github.com/opencost/opencost/core/pkg/log"
  4. "github.com/opencost/opencost/pkg/env"
  5. )
  6. // Config contain configuration options that can be passed to the Execute() method
  7. type Config struct {
  8. Port int
  9. KubernetesEnabled bool
  10. CarbonEstimatesEnabled bool
  11. CloudCostEnabled bool
  12. CustomCostEnabled bool
  13. }
  14. func DefaultConfig() *Config {
  15. return &Config{
  16. Port: env.GetOpencostAPIPort(),
  17. KubernetesEnabled: env.IsKubernetesEnabled(),
  18. CarbonEstimatesEnabled: env.IsCarbonEstimatesEnabled(),
  19. CloudCostEnabled: env.IsCloudCostEnabled(),
  20. }
  21. }
  22. func (c *Config) log() {
  23. log.Infof("Kubernetes enabled: %t", c.KubernetesEnabled)
  24. log.Infof("Carbon Estimates enabled: %t", c.CarbonEstimatesEnabled)
  25. log.Infof("Cloud Costs enabled: %t", c.CloudCostEnabled)
  26. log.Infof("Custom Costs enabled: %t", c.CustomCostEnabled)
  27. }