Fix forced overrides
This commit is contained in:
@ -7,7 +7,7 @@ import (
|
||||
"os"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/caarlos0/env/v9"
|
||||
"github.com/caarlos0/env/v11"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
@ -39,7 +39,7 @@ func LoadConfig(ctx context.Context) (context.Context, error) {
|
||||
}
|
||||
|
||||
func loadConfig(configPath string) (*AppConfig, error) {
|
||||
cfg := newAppConfig()
|
||||
cfg := *DefaultConfig
|
||||
|
||||
if configPath != "" {
|
||||
file, err := os.Open(configPath)
|
||||
@ -49,16 +49,16 @@ func loadConfig(configPath string) (*AppConfig, error) {
|
||||
defer file.Close()
|
||||
|
||||
decoder := yaml.NewDecoder(file)
|
||||
if err := decoder.Decode(cfg); err != nil {
|
||||
if err := decoder.Decode(&cfg); err != nil {
|
||||
return nil, fmt.Errorf("could not decode config file: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := env.Parse(cfg); err != nil {
|
||||
if err := env.Parse(&cfg); err != nil {
|
||||
return nil, fmt.Errorf("could not parse environment variables: %w", err)
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
return &cfg, nil
|
||||
}
|
||||
|
||||
func getVersion() string {
|
||||
|
Reference in New Issue
Block a user