forked from ProjectSegfault/publapi
add error handling for reading configuration
This commit is contained in:
parent
2298cbeeee
commit
92b6cf890b
@ -92,7 +92,24 @@ func userdata(username, usersonline, ops string) Userinfo {
|
||||
}
|
||||
}
|
||||
viper.SetConfigFile(filename)
|
||||
viper.ReadInConfig()
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
log.Error("Couldn't read a users meta-info.toml file.", err, username)
|
||||
user := Userinfo{
|
||||
Name: username,
|
||||
}
|
||||
user.Created, _ = strconv.Atoi(crdstr)
|
||||
if isonline {
|
||||
user.Online = true
|
||||
} else {
|
||||
user.Online = false
|
||||
}
|
||||
if isop {
|
||||
user.Op = true
|
||||
} else {
|
||||
user.Op = false
|
||||
}
|
||||
return user
|
||||
}
|
||||
var user Userinfo
|
||||
user = Userinfo{}
|
||||
user.Name = username
|
||||
|
Loading…
Reference in New Issue
Block a user