on main help sign in
fix: disable providers (#1087)
ab96589Carlos Alexandro Becker
internal/config/load.go−5
@@ -126,11 +126,6 @@ func (c *Config) configureProviders(env env.Env, resolver VariableResolver, know
126 config, configExists := c.Providers.Get(string(p.ID))
126 config, configExists := c.Providers.Get(string(p.ID))
127 // if the user configured a known provider we need to allow it to override a couple of parameters
127 // if the user configured a known provider we need to allow it to override a couple of parameters
128 if configExists {
128 if configExists {
129− if config.Disable {
130− slog.Debug("Skipping provider due to disable flag", "provider", p.ID)
131− c.Providers.Del(string(p.ID))
132− continue
133− }
134 if config.BaseURL != "" {
129 if config.BaseURL != "" {
135 p.APIEndpoint = config.BaseURL
130 p.APIEndpoint = config.BaseURL
136 }
131 }
internal/config/load_test.go+4−4
@@ -543,10 +543,10 @@ func TestConfig_configureProvidersWithDisabledProvider(t *testing.T) {
543 err := cfg.configureProviders(env, resolver, knownProviders)
543 err := cfg.configureProviders(env, resolver, knownProviders)
544 require.NoError(t, err)
544 require.NoError(t, err)
545
545
546− // Provider should be removed from config when disabled
547− require.Equal(t, cfg.Providers.Len(), 0)
546+ require.Equal(t, cfg.Providers.Len(), 1)
548− _, exists := cfg.Providers.Get("openai")
547+ prov, exists := cfg.Providers.Get("openai")
549− require.False(t, exists)
548+ require.True(t, exists)
549+ require.True(t, prov.Disable)
550}
550}
551
551
552func TestConfig_configureProvidersCustomProviderValidation(t *testing.T) {
552func TestConfig_configureProvidersCustomProviderValidation(t *testing.T) {