diff --git a/api/config_file.go b/api/config_file.go index 01b99ae..1797054 100644 --- a/api/config_file.go +++ b/api/config_file.go @@ -14,8 +14,11 @@ func configFileLoad(filepath string) error { defer file.Close() + num := 0 scanner := bufio.NewScanner(file) for scanner.Scan() { + num += 1 + line := strings.TrimSpace(scanner.Text()) if line == "" { continue @@ -27,7 +30,8 @@ func configFileLoad(filepath string) error { i := strings.Index(line, "=") if i == -1 { - continue + logger.Errorf("%s: line %d: neither a comment nor a valid setting", filepath, num) + return errorInvalidConfigFile } key := line[:i] diff --git a/api/errors.go b/api/errors.go index 408c9e8..223a3f3 100644 --- a/api/errors.go +++ b/api/errors.go @@ -38,3 +38,4 @@ var errorNotADirectory = errors.New("The given path is not a directory.") var errorGzip = errors.New("Cannot GZip content.") var errorCannotDownloadDisqus = errors.New("We could not download your Disqus export file.") var errorSelfVote = errors.New("You cannot vote on your own comment.") +var errorInvalidConfigFile = errors.New("Invalid config file.")