config.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. MCPServerEnabled bool
  14. }
  15. func DefaultConfig() *Config {
  16. return &Config{
  17. Port: env.GetOpencostAPIPort(),
  18. KubernetesEnabled: env.IsKubernetesEnabled(),
  19. CarbonEstimatesEnabled: env.IsCarbonEstimatesEnabled(),
  20. CloudCostEnabled: env.IsCloudCostEnabled(),
  21. MCPServerEnabled: env.IsMCPServerEnabled(),
  22. CustomCostEnabled: env.IsCustomCostEnabled(),
  23. }
  24. }
  25. func (c *Config) log() {
  26. log.Infof("Kubernetes enabled: %t", c.KubernetesEnabled)
  27. log.Infof("Carbon Estimates enabled: %t", c.CarbonEstimatesEnabled)
  28. log.Infof("Cloud Costs enabled: %t", c.CloudCostEnabled)
  29. log.Infof("Custom Costs enabled: %t", c.CustomCostEnabled)
  30. log.Infof("MCP Server enabled: %t", c.MCPServerEnabled)
  31. log.Infof("Custom Costs enabled: %t", c.CustomCostEnabled)
  32. }