update default values for client config

This commit is contained in:
shoopea 2020-04-07 10:26:04 +08:00
parent b083cdd9cd
commit 01ab600410

View File

@ -29,22 +29,15 @@ func loadClients() error {
muxClients.Lock()
for _, c := range clts {
cx := ChirpClient{}
copier.Copy(&cx, &c)
cx.Active = false
if cx.Config == nil {
cx.Config = &ChirpConfig{
cx := ChirpClient{
ChirpConfig{
InterceptPillage: true,
Wartime: `🛡Defend`,
},
}
} else {
if cx.Config.InterceptPillage == nil {
cx.Config.InterceptPillage = true
}
if len(cx.Config.Wartime) == 0 {
cx.Config.Wartime = `🛡Defend`
}
}
copier.Copy(&cx, &c)
cx.Active = false
/*
cx.MQ.Connection, err = amqp.Dial("amqp://" + cx.MQ.User + ":" + cx.MQ.Password + "@" + cx.MQ.Host + "/" + cx.MQ.Path)
logOnError(err, "loadClients : Failed to connect to RabbitMQ")