Jelajahi Sumber

fix: remove dead provider-config plumbing from currency conversion wiring

The original PR #3553 declared `var cp models.Provider` in Execute()
without ever assigning it, guarded `if cp != nil` (always false) around
a `provider.ExtractConfigFromProviders(cp)` call, and threaded the
resulting zero-value `providerConfig` into `InitializeCloudCost` where
it was never used. The required `models`/`provider` imports were also
missing, so the file did not compile as-submitted.

Remove the dead declaration, the dead conditional, and the unused
`providerConfig` parameter from `InitializeCloudCost`. Keeps the API
surface minimal and makes the file compile without the phantom imports.

Signed-off-by: Warwick Peatey <warwick@automatic.systems>
Assisted-by: Claude Code
Warwick Peatey 1 bulan lalu
induk
melakukan
09e0ad2888
2 mengubah file dengan 3 tambahan dan 8 penghapusan
  1. 2 7
      pkg/cmd/costmodel/costmodel.go
  2. 1 1
      pkg/costmodel/router.go

+ 2 - 7
pkg/cmd/costmodel/costmodel.go

@@ -43,8 +43,7 @@ func Execute(conf *Config) error {
 
 	router := httprouter.New()
 	var a *costmodel.Accesses
-	var cp models.Provider
-	
+
 	// Initialize currency converter
 	var currencyConverter currency.Converter
 	currencyAPIKey := env.GetCurrencyAPIKey()
@@ -92,11 +91,7 @@ func Execute(conf *Config) error {
 
 	var cloudCostPipelineService *cloudcost.PipelineService
 	if conf.CloudCostEnabled {
-		var providerConfig models.ProviderConfig
-		if cp != nil {
-			providerConfig = provider.ExtractConfigFromProviders(cp)
-		}
-		cloudCostPipelineService = costmodel.InitializeCloudCost(router, providerConfig, currencyConverter)
+		cloudCostPipelineService = costmodel.InitializeCloudCost(router, currencyConverter)
 	}
 
 	var customCostPipelineService *customcost.PipelineService

+ 1 - 1
pkg/costmodel/router.go

@@ -610,7 +610,7 @@ func GetDefaultCollectorStorage() storage.Storage {
 }
 
 // InitializeCloudCost Initializes Cloud Cost pipeline and querier and registers endpoints
-func InitializeCloudCost(router *httprouter.Router, providerConfig models.ProviderConfig, currencyConverter currency.Converter) *cloudcost.PipelineService {
+func InitializeCloudCost(router *httprouter.Router, currencyConverter currency.Converter) *cloudcost.PipelineService {
 	log.Debugf("Cloud Cost config path: %s", env.GetCloudCostConfigPath())
 	cloudConfigController := cloudconfig.NewMemoryController(nil)