ref: error out on unknown config keys

This commit is contained in:
Leon Richardt 2022-08-23 12:04:56 +02:00
parent b3f6b5a590
commit 7985419e1e
No known key found for this signature in database
GPG key ID: AD8BDD6273FE8FC5
2 changed files with 4 additions and 2 deletions

View file

@ -6,6 +6,8 @@ import (
"os" "os"
"strconv" "strconv"
"strings" "strings"
"github.com/go-errors/errors"
) )
const ( const (
@ -142,7 +144,7 @@ func ConfigFromFile(filePath string) (*Config, error) {
retval.ExifAbortOnError = parsed retval.ExifAbortOnError = parsed
default: default:
log.Printf("unexpected key: \"%s\", ignoring\n", key) return nil, errors.Errorf("unexpected config key: \"%s\"", key)
} }
} }

2
jaf.go
View file

@ -37,7 +37,7 @@ func main() {
// Read config // Read config
config, err := ConfigFromFile(params.configFile) config, err := ConfigFromFile(params.configFile)
if err != nil { if err != nil {
log.Fatalf("could not read config file: %s\n", err.Error()) log.Fatalf("could not parse config file: %s\n", err.Error())
} }
handler := uploadHandler{ handler := uploadHandler{