fixes config
This commit is contained in:
parent
6151a6c397
commit
12ad427baf
10 changed files with 57 additions and 51 deletions
|
@ -2,6 +2,7 @@ package config
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"maps"
|
||||
"os"
|
||||
|
||||
"govd/models"
|
||||
|
@ -21,17 +22,15 @@ func LoadExtractorConfigs() error {
|
|||
}
|
||||
data, err := os.ReadFile(configPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("errore nella lettura del file di configurazione: %w", err)
|
||||
return fmt.Errorf("failed reading config file: %w", err)
|
||||
}
|
||||
|
||||
var rawConfig map[string]*models.ExtractorConfig
|
||||
|
||||
if err := yaml.Unmarshal(data, &rawConfig); err != nil {
|
||||
return fmt.Errorf("errore nella decodifica del file YAML: %w", err)
|
||||
}
|
||||
for codeName, config := range rawConfig {
|
||||
extractorConfigs[codeName] = config
|
||||
return fmt.Errorf("failed parsing config file: %w", err)
|
||||
}
|
||||
maps.Copy(extractorConfigs, rawConfig)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue