diff --git a/config.go b/config.go index 5079df0f..9dc425ea 100644 --- a/config.go +++ b/config.go @@ -41,10 +41,6 @@ func New(opts ...Option) (Config, error) { continue } - if configAware, ok := loader.(ConfigAware); ok { - configAware.WithConfig(config) - } - values, err := loader.Load() if err != nil { return Config{}, fmt.Errorf("[konf] load configuration: %w", err) diff --git a/config_test.go b/config_test.go index ad2ce652..4c37d9d1 100644 --- a/config_test.go +++ b/config_test.go @@ -111,17 +111,6 @@ func TestConfig_Unmarshal(t *testing.T) { assert.Equal(t, "", cfg) }, }, - { - description: "configer", - opts: []konf.Option{ - konf.WithLoader(mapLoader{}), - }, - assert: func(config konf.Config) { - var configured bool - assert.NoError(t, config.Unmarshal("configured", &configured)) - assert.True(t, configured) - }, - }, } for i := range testcases { @@ -139,14 +128,6 @@ func TestConfig_Unmarshal(t *testing.T) { type mapLoader map[string]any -func (m mapLoader) WithConfig( - interface { - Unmarshal(path string, target any) error - }, -) { - m["configured"] = true -} - func (m mapLoader) Load() (map[string]any, error) { return m, nil } diff --git a/provider.go b/provider.go index 4faf6a4b..953368aa 100644 --- a/provider.go +++ b/provider.go @@ -22,13 +22,3 @@ type Loader interface { type Watcher interface { Watch(ctx context.Context, onChange func(map[string]any)) error } - -// ConfigAware is the interface that wraps the WithConfig method. -// -// WithConfig enables provider uses configuration loaded by providers before it. -// It ensures the WithConfig is called before executing methods in Loader and Watcher. -type ConfigAware interface { - WithConfig(config interface { - Unmarshal(path string, target any) error - }) -}