Fix rest of var name in main code

This commit is contained in:
Kristoffer Dalby 2021-11-15 16:15:50 +00:00
parent 471c0b4993
commit 333be80f9c
No known key found for this signature in database
GPG key ID: 09F62DC067465735
6 changed files with 137 additions and 130 deletions

6
db.go
View file

@ -100,18 +100,18 @@ func (h *Headscale) getValue(key string) (string, error) {
// setValue sets value for the given key in KV.
func (h *Headscale) setValue(key string, value string) error {
kv := KV{
keyValue := KV{
Key: key,
Value: value,
}
if _, err := h.getValue(key); err == nil {
h.db.Model(&kv).Where("key = ?", key).Update("value", value)
h.db.Model(&keyValue).Where("key = ?", key).Update("value", value)
return nil
}
h.db.Create(kv)
h.db.Create(keyValue)
return nil
}