Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use koanfv2 for imported module #212

Merged
merged 2 commits into from
Nov 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/knadh/koanf/providers/env"
"github.com/knadh/koanf/providers/file"
"github.com/knadh/koanf/providers/rawbytes"
"github.com/knadh/koanf/v2"
koanfv2 "github.com/knadh/koanf/v2"
)

// NewDefaultConfig initializes the configuration with default values
Expand Down Expand Up @@ -128,9 +128,9 @@ func (c *FTWConfiguration) WithMaxMarkerLogLines(amount int) {
}

// Unmarshal the loaded koanf instance into a configuration object
func unmarshal(k *koanf.Koanf) (*FTWConfiguration, error) {
func unmarshal(k *koanfv2.Koanf) (*FTWConfiguration, error) {
config := NewDefaultConfig()
err := k.UnmarshalWithConf("", config, koanf.UnmarshalConf{Tag: "koanf"})
err := k.UnmarshalWithConf("", config, koanfv2.UnmarshalConf{Tag: "koanf"})
if err != nil {
return nil, err
}
Expand All @@ -139,7 +139,7 @@ func unmarshal(k *koanf.Koanf) (*FTWConfiguration, error) {
}

// Get the global koanf instance
func getKoanfInstance() *koanf.Koanf {
func getKoanfInstance() *koanfv2.Koanf {
// Use "." as the key path delimiter. This can be "/" or any character.
return koanf.New(".")
return koanfv2.New(".")
}