server: Fix SIGINT handling after loading bad configuration

Also fix the config error messages.

Fixes #9664
This commit is contained in:
Bjørn Erik Pedersen
2022-05-15 21:01:36 +02:00
parent fc9f315d86
commit 87a22eb6d6
4 changed files with 60 additions and 14 deletions

View File

@@ -59,6 +59,13 @@ func FromConfigString(config, configType string) (Provider, error) {
func FromFile(fs afero.Fs, filename string) (Provider, error) {
m, err := loadConfigFromFile(fs, filename)
if err != nil {
fe := herrors.UnwrapFileError(err)
if fe != nil {
pos := fe.Position()
pos.Filename = filename
fe.UpdatePosition(pos)
return nil, err
}
return nil, herrors.NewFileErrorFromFile(err, filename, fs, nil)
}
return NewFrom(m), nil