config.go 1.2 KB

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