Instantly quit if it's not possible to read the config file.

This commit is contained in:
Martin Dosch 2020-04-03 14:28:08 +02:00
parent bf4ec88e00
commit ee7bf1fb71

View File

@ -208,11 +208,12 @@ func main() {
recipients[i] = validatedJid
}
// Read configuration file if user, server or password is not specified.
if *flagUser == "" || *flagServer == "" || *flagPassword == "" {
// Read configuration from file.
config, err := parseConfig(*flagFile)
if err != nil {
log.Println("Error parsing ", *flagFile, ": ", err)
log.Fatal("Error parsing ", *flagFile, ": ", err)
}
// Set connection options according to config.
user = config.username