mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
Add config.Toml type to handle config files
This change introduced a config.Toml type that is used as the base for config file processing and manipulation. This ensures that configs -- including commented values -- can be handled consistently. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
@@ -43,13 +43,15 @@ func loadConfig() (*config.Config, error) {
|
||||
}
|
||||
|
||||
for _, p := range configPaths {
|
||||
cfg, err := config.Load(p)
|
||||
cfg, err := config.New(
|
||||
config.WithConfigFile(p),
|
||||
)
|
||||
if err == nil {
|
||||
return cfg, nil
|
||||
return cfg.Config()
|
||||
} else if os.IsNotExist(err) && !required {
|
||||
continue
|
||||
}
|
||||
return nil, fmt.Errorf("couldn't open configuration file: %v", err)
|
||||
return nil, fmt.Errorf("couldn't open required configuration file: %v", err)
|
||||
}
|
||||
|
||||
return config.GetDefault()
|
||||
|
||||
Reference in New Issue
Block a user